perm filename MEMO.PLT[HAL,HE]1 blob
sn#132170 filedate 1974-08-29 generic text, type T, neo UTF8
/LMAR=200/FONT#0=BASL30/FONT#3=BASI30/FONT#4=BASB30/FONT#5=BDR40/FONT#6=LPT
␈↓STANFORD ARTIFICIALL INTELLIGENCE LABORATORY ␈↓ ASEPTEMBER 1974
␈↓MEMO AIM-243
␈↓COMPUTER SCIENCE DEPARTMENT
␈↓REPORT CS-
␈↓␈α?␈α?␈α?␈α*␈↓¬HAL, A Programming System for Automation
␈↓¬␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβ␈↓∧Preliminary Report
␈↓∧␈α?␈α?␈απ␈↓Raphael Finkel, Russell Taylor, Robert Bolles, Richard Paul, Jerome Feldman
␈↓␈↓ αHHAL,␈α
a␈α∞new␈α
language␈α∞for␈α
specification␈α
of␈α∞manipulatory␈α
actions,␈α∞is␈α
described.
␈↓␈↓ αHIt␈α
is␈α
the␈α
most␈α
recent␈α
in␈α
a␈αseries␈α
of␈α
efforts␈α
in␈α
this␈α
direction,␈α
a␈α
series␈αincluding,␈α
in
␈↓␈↓ αHparticular,␈α∂APT␈α∂and␈α∞WAVE.␈α∂ The␈α∂HAL␈α∞system␈α∂includes␈α∂a␈α∂source␈α∞language
␈↓␈↓ αHwith␈α
advanced␈αfeatures␈α
for␈αdescribing␈α
individual␈αmotions␈α
of␈αmanipulators␈α
and
␈↓␈↓ αHcomplex␈α⊂series␈α⊂of␈α⊃motions␈α⊂making␈α⊂up␈α⊂an␈α⊃entire␈α⊂assembly,␈α⊂and␈α⊃the␈α⊂runtime
␈↓␈↓ αHsystem necessary for execution of programs.
␈↓__________________________________________________________________________________________␈↓ >
␈↓␈↓βThis␈α∩research␈α∩was␈α∩supported␈α∪in␈α∩part␈α∩by␈α∩the␈α∪National␈α∩Science␈α∩Foundation␈α∩under␈α∪contract␈α∩No.
␈↓βGI-42906␈α∞and␈α∞in␈α∞part␈α∞by␈α∞the␈α∞Advanced␈α∞Research␈α∞Projects␈α∞Agency␈α∞of␈α∞the␈α∞Office␈α∞of␈α∞Defense␈α
under
␈↓βContract No. DAHC-15-73-C-0435
␈↓βThe␈α
views␈αand␈α
conclusions␈α
in␈αthis␈α
document␈α
are␈αthose␈α
of␈α
the␈αauthors␈α
and␈α
should␈αnot␈α
be␈αinterpreted␈α
as
␈↓βnecessarily representing the official policies, either expressed or implied, of the funding agencies.
␈↓βReproduced␈α∂in␈α∞the␈α∂USA.␈α∞Available␈α∂from␈α∞the␈α∂National␈α∞Technical␈α∂Information␈α∂Service,␈α∞Springfield,
␈↓βVirginia 22151.␈↓
␈↓Page ii␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α→FOREWORD␈↓ H
␈↓This␈αdocument␈αdescribes␈αthe␈αnew␈αhand␈αlanguage,␈αHAL.␈α It␈αis␈αnot␈αintended␈αto␈αbe␈αa␈αfinal␈αlanguage
␈↓specification␈α
or␈α
a␈αuser's␈α
manual.␈α
Rather,␈αit␈α
is␈α
a␈αworking␈α
document;␈α
it␈αpresents␈α
a␈α
number␈αof␈α
related
␈↓ideas␈α⊂concerning␈α∂a␈α⊂system␈α⊂for␈α∂programmable␈α⊂automation.␈α∂ These␈α⊂ideas␈α⊂cover␈α∂quite␈α⊂a␈α⊂range␈α∂of
␈↓topics:␈α∪arm␈α∪servoing,␈α∪parallel␈α∪processing,␈α∪assembly␈α∪world␈α∪modelling,␈α∪strategists,␈α∪and␈α∩language
␈↓design.␈α⊃ We␈α⊃have␈α⊂tried␈α⊃to␈α⊃combine␈α⊂these␈α⊃into␈α⊃a␈α⊂coherent␈α⊃system.␈α⊃ However,␈α⊂as␈α⊃you␈α⊃read␈α⊂this
␈↓document␈α↔you␈α↔will␈α↔notice␈α↔that␈α↔some␈α⊗topics␈α↔have␈α↔been␈α↔explored␈α↔more␈α↔than␈α↔others,␈α⊗some
␈↓explanations␈αcontain␈α
more␈αdetails␈α
than␈αothers,␈αand␈α
some␈αquestions␈α
are␈αleft␈α
unanswered.␈α Various
␈↓portions␈α
of␈α
the␈α
system␈α
have␈α
already␈α
been␈α
implemented.␈α
The␈α
current␈α
state␈α
of␈α
the␈α
system␈αis␈α
discussed
␈↓in␈α
an␈α
appendix.␈α
At␈αpresent␈α
HAL␈α
is␈α
still␈αsomewhat␈α
in␈α
a␈α
state␈α
of␈αflux;␈α
we␈α
are␈α
presenting␈αthese␈α
ideas
␈↓to solicit constructive suggestions.
␈↓Interested␈α
persons␈α
unfamiliar␈α∞with␈α
the␈α
background␈α
for␈α∞this␈α
work␈α
will␈α
find␈α∞it␈α
useful␈α
to␈α∞read␈α
␈↓βThe
␈↓βUse of Sensory Feedback in a Programmable Assembly System␈↓ [Bolles].
␈↓We␈α∂would␈α∞like␈α∂to␈α∞thank␈α∂those␈α∞people␈α∂who␈α∞have␈α∂already␈α∞made␈α∂numerous␈α∞suggestions␈α∂and␈α∞have
␈↓helped␈αimplement␈αvarious␈αparts␈αof␈αthe␈αsystem.␈α In␈αparticular,␈αwe␈αwould␈αto␈αthank␈αBertrand␈αMeyer,
␈↓who␈α∂is␈α⊂implementing␈α∂the␈α⊂scanner␈α∂and␈α⊂parser,␈α∂and␈α∂Bo␈α⊂Eross,␈α∂who␈α⊂is␈α∂implementing␈α⊂the␈α∂PDP11
␈↓runtime␈α⊗monitor.␈α⊗ We␈α⊗would␈α⊗also␈α⊗like␈α↔to␈α⊗thank␈α⊗Bruce␈α⊗Baumgart,␈α⊗who␈α⊗assisted␈α↔with␈α⊗the
␈↓illustrations.
␈↓The␈αEnglish␈αlanguage␈αhas␈αno␈αgenderless␈αpersonal␈αpronoun;␈αwithout␈αany␈αimplication␈αof␈αsexism␈αwe
␈↓use the feminine form in its place.
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α_TABLE OF CONTENTS␈↓
dPage iii
␈↓CHAPTER ␈↓
rPAGE
␈↓1 INTRODUCTION ␈↓ 91
␈↓2 GOALS ␈↓ 92
␈↓ 2.1 HIGH LEVEL LANGUAGE FOR MANIPULATOR CONTROL ␈↓ 92
␈↓ 2.2 THE RUNTIME SYSTEM ␈↓ 93
␈↓ 2.3 PROGRAMMING AIDS ␈↓ 94
␈↓ 2.4 SOPHISTICATED USE OF WORLD MODEL INFORMATION ␈↓ 94
␈↓3 GENERAL SYSTEM OUTLINE ␈↓ 96
␈↓ 3.1 HARDWARE ␈↓ 96
␈↓ 3.2 SOFTWARE ␈↓ 96
␈↓4 SOURCE LANGUAGE ␈↓ 99
␈↓ 4.1 THE HAL COMPILER ␈↓ 99
␈↓ 4.1.1 PARSER ␈↓ 99
␈↓ 4.1.2 EXPANDER ␈↓ 99
␈↓ 4.1.3 TRAJECTORY CALCULATOR ␈↓ *10
␈↓ 4.2 CONTROL STRUCTURES ␈↓ *12
␈↓ 4.2.1 TRADITIONAL ALGOL STRUCTURES ␈↓ *12
␈↓ 4.2.2 COBEGIN-COEND ␈↓ *13
␈↓ 4.2.3 PARTIAL ORDERING OF SUBTASKS ␈↓ *13
␈↓ 4.2.4 EVENTS: SIGNAL AND WAIT ␈↓ *14
␈↓ 4.2.5 ON MONITORS ␈↓ *15
␈↓ 4.2.6 UNITS ␈↓ *16
␈↓ 4.2.7 COMMENTS ␈↓ *17
␈↓ 4.2.8 LABELS ␈↓ *17
␈↓ 4.2.9 ABORT ␈↓ *18
␈↓ 4.2.10 OUTPUT ␈↓ *18
␈↓ 4.2.11 PROCEDURES ␈↓ *19
␈↓ 4.3 DATA STRUCTURES ␈↓ *20
␈↓ 4.3.1 DECLARATIONS. PLANNING VALUES. ASSERTIONS ␈↓ *20
␈↓ 4.3.2 ALGEBRAIC DATATYPES ␈↓ *21
␈↓ 4.3.3 ARITHMETIC ␈↓ *23
␈↓ 4.3.4 SOME EXAMPLES OF ARITHMETIC EXPRESSIONS ␈↓ *25
␈↓ 4.4 MOTIONS ␈↓ *26
␈↓ 4.4.1 COMPILE-TIME AND RUNTIME CONSIDERATIONS ␈↓ *26
␈↓ 4.4.2 SIMPLE MOVES ␈↓ *27
␈↓ 4.4.3 OPTIONS FOR MOVES ␈↓ *28
␈↓ 4.4.4 DEPROACHES ␈↓ *30
␈↓ 4.4.5 COMPLEX MOVES ␈↓ *31
␈↓ 4.4.6 SEARCHES ␈↓ *32
␈↓ 4.4.7 CENTER ␈↓ *33
␈↓ 4.4.8 CONSTANT VELOCITY MOTION ␈↓ *34
␈↓Page iv␈α?␈α?␈α?␈α?␈α?␈α?␈απTABLE OF CONTENTS␈↓ H
␈↓CHAPTER␈↓
rPAGE
␈↓ 4.4.9 DEVICE CONTROL ␈↓ *34
␈↓ 4.5 ATTACHMENT ␈↓ *35
␈↓ 4.6 GRAPH STRUCTURES ␈↓ *37
␈↓ 4.6.1 CONCERNING ATTACH AND DETACH ␈↓ *39
␈↓ 4.7 COMPILE-TIME CONSTRUCTS ␈↓ *40
␈↓ 4.7.1 ASSERTIONS ␈↓ *40
␈↓ 4.7.2 CONDITIONAL EXPANSION ␈↓ *42
␈↓ 4.7.3 THE COMPILE-TIME CHECK STATEMENT ␈↓ *43
␈↓ 4.7.4 BINDING BOOLEANS ␈↓ *43
␈↓ 4.7.5 COMPILE FOREACH ␈↓ *45
␈↓ 4.7.6 COMPILE-TIME PREDICATE FUNCTIONS ␈↓ *46
␈↓ 4.7.7 COMPILE-TIME VARIABLES ␈↓ *47
␈↓ 4.8 LIBRARY ROUTINES ␈↓ *51
␈↓ 4.8.1 SAVING LIBRARY ROUTINES ␈↓ *54
␈↓ 4.8.2 SAVING AND RESTORING PLANNING VALUES ␈↓ *54
␈↓5 VERY HIGH LEVEL LANGUAGE CAPABILITIES ␈↓ *56
␈↓ 5.1 INTRODUCTION ␈↓ *56
␈↓ 5.2 MACRO OPERATIONS AS A `HIGH LEVEL LANGUAGE' ␈↓ *57
␈↓ 5.3 MORE POWERFUL PRIMITIVES -- AN OVERVIEW ␈↓ *57
␈↓ 5.4 CALLING HIGH LEVEL PRIMITIVES ␈↓ *58
␈↓ 5.5 WORLD MODELLING OVERVIEW ␈↓ *60
␈↓ 5.6 INFORMATION ABOUT VARIABLES ␈↓ *61
␈↓ 5.7 OBJECT DESCRIPTION ␈↓ *63
␈↓ 5.7.1 ONE-PIECE OBJECTS ␈↓ *64
␈↓ 5.7.2 ASSEMBLIES ␈↓ *66
␈↓ 5.8 EXAMPLE: WATERPUMP ASSEMBLY PROGRAM ␈↓ *69
␈↓6 RUNTIME OVERVIEW ␈↓ *74
␈↓ 6.1 CONTROL STRUCTURES ␈↓ *74
␈↓ 6.2 DATA STRUCTURES ␈↓ *75
␈↓ 6.2.1 VALUE CELLS ␈↓ *75
␈↓ 6.2.2 GRAPH STRUCTURES ␈↓ *76
␈↓7 USER FEATURES ␈↓ *77
␈↓ 7.1 PROGRAM FORMULATION ␈↓ *77
␈↓ 7.2 PROGRAM COMPILATION ␈↓ *77
␈↓ 7.3 PROGRAM EXECUTION ␈↓ *78
␈↓8 EXAMPLE DIALOG WITH THE HAL SYSTEM ␈↓ *79
␈↓9 EXTENSIONS TO HAL ␈↓ *82
␈↓ 9.1 INCORPORATING VISUAL FEEDBACK ␈↓ *82
␈↓ 9.1.1 NECESSARY CAPABILITIES ␈↓ *82
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α_TABLE OF CONTENTS␈↓
nPage v
␈↓CHAPTER␈↓
rPAGE
␈↓ 9.1.2 STAGES IN INCORPORATING VISUAL FEEDBACK ␈↓ *83
␈↓ 9.2 DYNAMIC FRAMES ␈↓ *84
␈↓ 9.3 EXTENSIONS TO OTHER ARMS AND DEVICES ␈↓ *86
␈↓ 9.4 FINE CONTROL ␈↓ *86
␈↓ 9.5 COLLISION AVOIDING ␈↓ *86
␈↓10 CONCLUSION ␈↓ *87
␈↓11 BIBLIOGRAPHY ␈↓ *88
␈↓APPENDICES
␈↓I PROGRAMMING EXAMPLES ␈↓ *90
␈↓ I.1 BOLTING A BRACKET ONTO A BEAM ␈↓ *90
␈↓ I.1.1 EXAMPLE ONE ␈↓ *91
␈↓ I.1.2 EXAMPLE TWO ␈↓ *94
␈↓ I.1.3 EXAMPLE THREE ␈↓ *97
␈↓ I.2 EXAMPLES OF COORDINATED ACTION ␈↓ ≠105
␈↓ I.3 A `VERY HIGH LEVEL' EXAMPLE ␈↓ ≠108
␈↓II RUNTIME SYSTEM ␈↓ ≠110
␈↓ II.1 THE RUNTIME SCHEDULER ␈↓ ≠110
␈↓ II.2 PHILOSOPHY OF SERVOING ␈↓ ≠111
␈↓ II.3 JOINT SERVOING ␈↓ ≠112
␈↓ II.4 TRAJECTORIES ␈↓ ≠113
␈↓ II.5 INTERPRETABLE CODE ␈↓ ≠114
␈↓ II.6 ALGORITHMS FOR USE OF GRAPH STRUCTURE ␈↓ ≠116
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α
␈↓
pPage 1
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α1␈↓∧CHAPTER 1␈↓
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α(␈↓¬INTRODUCTION␈↓
␈↓The␈α
development␈α
of␈α
mechanical␈α
manipulators␈α
during␈α
the␈α
Late␈α
Middle␈α
Ages␈α
of␈α
1948␈α
soon␈α
led␈αto
␈↓the␈α∩realization␈α∪that␈α∩most␈α∪tasks␈α∩require␈α∪position␈α∩and␈α∩force␈α∪feedback.␈α∩ For␈α∪the␈α∩last␈α∪ten␈α∩years,
␈↓computers␈α
have␈α
been␈α
used␈α∞as␈α
a␈α
controlling␈α
agent.␈α
This␈α∞has␈α
led␈α
to␈α
sophisticated␈α∞servo␈α
programs
␈↓which␈α∂periodically␈α∂compute␈α∞a␈α∂controlling␈α∂signal␈α∂from␈α∞comparison␈α∂of␈α∂current␈α∂manipulator␈α∞status
␈↓against the planned status.
␈↓Elementary␈α∂languages␈α∂have␈α∂been␈α∂built␈α∂for␈α∂the␈α∂purpose␈α∂of␈α∂automating␈α∂tasks␈α∂more␈α⊂lengthy␈α∂than
␈↓simple␈α⊗motions.␈α↔These␈α⊗languages␈α⊗have␈α↔much␈α⊗the␈α⊗flavor␈α↔of␈α⊗assembly␈α↔languages;␈α⊗primitive
␈↓commands␈α⊃involve␈α⊂those␈α⊃necessary␈α⊂for␈α⊃planning␈α⊃various␈α⊂kinds␈α⊃of␈α⊂motions,␈α⊃for␈α⊃controlling␈α⊂the
␈↓execution of the computed plans, and for simple response to error conditions.
␈↓APT␈α∂is␈α∂one␈α∂highly␈α∂successful␈α∂system␈α∂for␈α∂the␈α∂automation␈α∂of␈α∂parts-machining␈α∂tasks.␈α⊂ It␈α∂provides
␈↓open-loop␈α
control␈α
of␈α
metal␈α
cutting␈α
machines␈α
and␈α
allows␈α
precision␈α
cutting␈α
along␈α
curved␈α
lines␈α
and
␈↓accurate␈αworkpiece␈αpositioning.␈α The␈αprincipal␈αfailings␈αof␈αAPT␈αinvolve␈αits␈αpoverty␈α
of␈αdescriptive
␈↓ability␈α∀for␈α∀complicated␈α∪motions,␈α∀the␈α∀resulting␈α∀limitation␈α∪on␈α∀the␈α∀type␈α∪of␈α∀tasks␈α∀which␈α∀it␈α∪can
␈↓accomplish, and its restriction to metal cutting machines.
␈↓Another␈α⊂example␈α⊂of␈α∂a␈α⊂system␈α⊂for␈α⊂manipulator␈α∂control␈α⊂is␈α⊂WAVE␈α∂at␈α⊂Stanford.␈α⊂ It␈α⊂includes␈α∂two
␈↓Scheinman␈α∩electrical␈α∩arms␈α∪and␈α∩software␈α∩for␈α∩preparing␈α∪moderately␈α∩complex␈α∩plans.␈α∪ The␈α∩most
␈↓impressive␈α∂accomplishment␈α∂of␈α∂this␈α∂system␈α∂has␈α∂been␈α∂the␈α∂assembly␈α∂of␈α∂a␈α∂water␈α∂pump,␈α⊂which␈α∂was
␈↓done␈α⊂with␈α⊂one␈α⊂arm,␈α⊂and␈α⊂optionally␈α⊂made␈α⊂use␈α⊂of␈α⊂visual␈α⊂feedback.␈α⊂ Further␈α⊂achievements␈α∂have
␈↓included␈α∩a␈α∩primitive␈α∩two-arm␈α∩task:␈α∩the␈α∩assembly␈α∩of␈α∩a␈α∩hinge.␈α∩ WAVE␈α∩currently␈α∩can␈α⊃produce
␈↓independent␈α
plans␈α
for␈α
the␈α
two␈α
arms.␈α
The␈αonly␈α
form␈α
of␈α
coordination␈α
is␈α
achieved␈α
by␈α
halting␈αone
␈↓arm␈α
and␈α
starting␈α
the␈α
other␈α
one.␈α
The␈α
world␈α
model␈α
contained␈α
in␈α
the␈α
system␈α
is␈α
quite␈α
limited:␈αA␈α
small
␈↓number␈αof␈α
hand␈αpositions␈αcan␈α
be␈αremembered;␈αeach␈α
of␈αthese␈αpositions␈α
can␈αbe␈αassociated␈α
with␈αan
␈↓"offset"␈α⊂between␈α⊂planned␈α⊂position␈α⊂and␈α⊂real␈α⊂position.␈α⊂ This␈α⊂information␈α⊂is␈α⊂obtained␈α⊂during␈α∂the
␈↓actual␈αexecution␈αof␈αa␈α
plan,␈αand␈αallows␈αrun-time␈α
modification␈αof␈αtrajectories.␈α The␈αsophistication␈α
of
␈↓the␈α
control␈α
structure␈αis␈α
also␈α
limited;␈α
there␈αare␈α
only␈α
simple␈αjumps,␈α
including␈α
conditionals␈α
on␈αerror
␈↓states.␈α When␈αa␈αplan␈αfails␈αdue␈αto␈αexcessive␈αrequests␈αon␈αhardware␈αability,␈αthe␈αuser␈αmay␈αrequest␈αthe
␈↓continuation␈α∞of␈α
the␈α∞plan.␈α
WAVE␈α∞also␈α
has␈α∞a␈α
clumsy␈α∞interface␈α
with␈α∞SAIL,␈α
which␈α∞is␈α∞a␈α
high-level
␈↓Algol-like language; thus, in principal, it can take advantage of SAIL's algebraic power.
␈↓None␈α⊂of␈α⊂the␈α∂currently␈α⊂available␈α⊂task-automation␈α⊂languages␈α∂is␈α⊂capable␈α⊂of␈α⊂efficiently␈α∂sequencing
␈↓tasks␈α⊃or␈α⊃planning␈α⊃other␈α∩strategy␈α⊃for␈α⊃the␈α⊃execution␈α⊃of␈α∩a␈α⊃task;␈α⊃they␈α⊃only␈α⊃can␈α∩translate␈α⊃explicit
␈↓instructions␈α⊃into␈α⊃machine-executable␈α⊃form.␈α⊂In␈α⊃this␈α⊃sense␈α⊃they␈α⊂can␈α⊃be␈α⊃thought␈α⊃of␈α⊃as␈α⊂"assembly
␈↓languages";␈α
some␈αof␈α
them␈α
are␈αrather␈α
fancy,␈αwith␈α
a␈α
macro␈αfacility,␈α
a␈α
few␈αnamed␈α
variables,␈αand␈α
some
␈↓simple arithmetic, but none can be called a high-level language.
␈↓The␈α
availability␈α
of␈αnew␈α
types␈α
of␈αhardware␈α
(for␈α
example,␈αforce-sensing␈α
wrists)␈α
and␈α
the␈αincreasing
␈↓complexity␈αof␈αthe␈αtasks␈α
we␈αwish␈αto␈αperform,␈α
as␈αwell␈αas␈αthe␈α
recognized␈αfailings␈αof␈αWAVE,␈αhave␈α
led
␈↓us␈αto␈αthe␈αdesign␈αof␈αa␈αnew␈αhand␈αlanguage,␈αwhich␈αis␈αcalled␈αHAL.␈α It␈αis␈αa␈αvery␈αhigh␈αlevel␈αlanguage
␈↓for␈α
the␈α
specification␈α
of␈αmanipulatory␈α
tasks␈α
(especially␈α
assembly␈α
tasks)␈αin␈α
a␈α
world␈α
of␈α
several␈αarms
␈↓and other devices. The following pages contain a description of HAL.
␈↓Page 2␈α?␈α?␈α?␈α?␈α?␈α5MANIPULATOR CONTROL␈↓ H
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0␈↓∧CHAPTER 2␈↓
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αλ␈↓¬GOALS␈↓
␈↓A␈α∞full␈α
language␈α∞for␈α
planning␈α∞manipulatory␈α
tasks␈α∞of␈α
the␈α∞complexity␈α
required␈α∞for␈α∞assembly␈α
needs
␈↓many␈α∩features,␈α∩some␈α∩of␈α∩which␈α∩do␈α∩not␈α∩exist␈α∩in␈α∩any␈α∩current␈α∩system.␈α∩ We␈α∩have␈α∪identified␈α∩the
␈↓following interrelated goals.
␈↓␈↓∧2.1 HIGH LEVEL LANGUAGE FOR MANIPULATOR CONTROL␈↓
␈↓The␈α
language␈αmust␈α
be␈αable␈α
to␈α
describe␈αthose␈α
things␈αimportant␈α
to␈αthe␈α
programmer.␈α
This␈αimplies
␈↓that␈α⊃there␈α⊃should␈α∩be␈α⊃datatypes␈α⊃natural␈α⊃to␈α∩the␈α⊃tasks␈α⊃at␈α⊃hand.␈α∩ Principally,␈α⊃there␈α⊃should␈α∩be␈α⊃a
␈↓datatype␈α
whose␈α
value␈α
is␈α
a␈α
location-orientation␈α
in␈α
3-space.␈α
Secondarily,␈α
there␈α
should␈α
be␈αvectors␈α
and
␈↓scalars. Arithmetic operations should be defined on these datatypes to make them useful.
␈↓We␈αwant␈αto␈αwrite␈αentire␈αprograms␈αin␈αa␈αnatural␈αmanner.␈α The␈αmachine-language␈αaspect␈αof␈αcurrent
␈↓manipulation␈α⊃languages␈α⊃makes␈α⊃it␈α⊃cumbersome␈α∩to␈α⊃write␈α⊃long␈α⊃programs␈α⊃in␈α⊃any␈α∩structured␈α⊃way.
␈↓What␈α⊗is␈α⊗desired␈α⊗is␈α⊗a␈α⊗language␈α↔which␈α⊗lends␈α⊗itself␈α⊗to␈α⊗a␈α⊗more␈α⊗systematic␈α↔and␈α⊗perspicuous
␈↓programming␈α
style.␈α
Algol-like␈αcontrol␈α
structures␈α
would␈α
be␈αa␈α
vast␈α
improvement␈α
over␈αassembly-like
␈↓straight code with jumps.
␈↓Simultaneous␈α∀execution␈α∀of␈α∀several␈α∀processes␈α∀should␈α∀be␈α∀available.␈α∀A␈α∀general␈α∃mechanism␈α∀for
␈↓simultaneity is desired.
␈↓Experience␈αwith␈αWAVE␈αhas␈αshown␈αthat␈αcalculating␈αtrajectories␈αis␈αa␈αdesirable␈αfeature,␈αalthough␈αa
␈↓time-consuming␈α∩one.␈α∩ Therefore,␈α∩a␈α∩motion␈α∪should␈α∩be␈α∩calculated␈α∩in␈α∩a␈α∩"compilation"␈α∪step,␈α∩and
␈↓executed␈α∞at␈α∞a␈α∞later␈α∞time,␈α∞perhaps␈α∞repeatedly.␈α
This␈α∞leads␈α∞to␈α∞a␈α∞clear␈α∞distinction␈α∞between␈α
compile-
␈↓time and runtime.
␈↓Since␈α∂locations␈α∞are␈α∂not␈α∂known␈α∞exactly␈α∂during␈α∞planning␈α∂of␈α∂a␈α∞trajectory,␈α∂there␈α∞should␈α∂be␈α∂a␈α∞clear
␈↓distinction␈α∃between␈α∃planned␈α∃values␈α∃and␈α∃runtime␈α∃values.␈α∃ Planned␈α∃values␈α∃will␈α∃be␈α∃used␈α∀for
␈↓trajectory␈α⊂calculation;␈α⊂at␈α⊂runtime,␈α⊂trajectories␈α⊂will␈α⊂be␈α⊂modified␈α⊂if␈α⊂necessary␈α⊂to␈α⊂account␈α⊃for␈α⊂any
␈↓discrepancies.
␈↓The␈α∞user␈α∞should␈α∂be␈α∞able␈α∞to␈α∂demand␈α∞that␈α∞a␈α∞trajectory␈α∂pass␈α∞through␈α∞certain␈α∂intermediate␈α∞points.
␈↓The␈α
primary␈αuse␈α
of␈αthis␈α
is␈αto␈α
avoid␈αcollisions␈α
during␈αthe␈α
motion.␈α It␈α
is␈αalso␈α
useful␈α
for␈αspecifying
␈↓complicated motions.
␈↓It␈α
is␈α
necessary␈αto␈α
test␈α
for␈αa␈α
wide␈α
range␈α
of␈αexceptional␈α
conditions␈α
during␈αarm␈α
motion␈α
and␈α
to␈αtake
␈↓appropriate␈αaction␈αas␈αsoon␈αas␈αany␈αof␈αthem␈αoccurs.␈α These␈αconditions␈αcould␈αinclude␈αexcessive␈αforce
␈↓being␈α∪exerted,␈α∪excessive␈α∪closeness␈α∪of␈α∪the␈α∀arms,␈α∪completion␈α∪of␈α∪some␈α∪related␈α∪task␈α∀being␈α∪done
␈↓independently␈αby␈α
other␈αdevices,␈αan␈α
interrupt␈αgenerated␈αby␈α
the␈αuser,␈αthe␈α
arrival␈αof␈αa␈α
certain␈αtime,
␈↓or␈αa␈αtemperature␈αsenser␈αreaching␈αa␈αcritical␈αpoint.␈α The␈αappropriate␈αactions␈αmight␈αbe␈αto␈αstart␈αup␈αa
␈↓new␈αconcurrent␈αprocess,␈αto␈αterminate␈αsomething␈αalready␈αactive,␈αto␈αnotify␈αthe␈αuser,␈αor␈αto␈αfile␈αaway␈α
a
␈↓statistic␈α
in␈αa␈α
table␈αsomewhere.␈α
It␈αis␈α
also␈αuseful␈α
to␈αchange␈α
the␈αnature␈α
of␈αthe␈α
test␈αduring␈α
a␈αmotion,␈α
if
␈↓2.1␈α?␈α?␈α?␈α?␈α?␈α?␈α≡MANIPULATOR CONTROL␈↓
pPage 3
␈↓different␈α⊃segments␈α⊃require␈α⊃different␈α⊃types␈α⊃of␈α⊃monitoring.␈α⊃ This␈α⊃concept␈α⊃can␈α⊃be␈α⊃generalized␈α⊂to
␈↓include␈α
the␈α
modification␈α
of␈α
a␈α
motion␈αduring␈α
its␈α
execution␈α
to␈α
accomodate␈α
to␈α
changing␈αconditions.
␈↓In␈α
any␈α
case,␈α
it␈α
should␈α
be␈αeasy␈α
for␈α
the␈α
user␈α
to␈α
specify␈α
exactly␈αwhat␈α
is␈α
being␈α
tested,␈α
what␈α
the␈αscope␈α
of
␈↓the test is (that is, when should it start and when should it end), and what to do if it triggers.
␈↓Assembly␈αtasks␈αrequire␈α
that␈αone␈αobject␈α
be␈αaffixed␈αto␈αanother.␈α
We␈αwish␈αto␈α
model␈αthis␈αby␈αhaving␈α
a
␈↓semantic␈α
attachment␈α
between␈α
objects.␈α
When␈α
one␈α
moves,␈α
the␈α
second␈α
one␈α
should␈α
move␈α
(that␈α
is,␈α
its
␈↓planning␈α∞value␈α∞should␈α∞be␈α∞modified)␈α∞accordingly.␈α∞ This␈α∞"attachment"␈α∞concept␈α∞carries␈α∞over␈α∂to␈α∞the
␈↓runtime␈αsystem,␈α
which␈αdoes␈αthe␈α
equivalent␈αmodifications␈αof␈α
the␈αactual␈αvalues.␈α
This␈αsaves␈αthe␈α
user
␈↓untold bookkeeping operations to determine where an object is after its base has been moved.
␈↓␈↓∧2.2 THE RUNTIME SYSTEM␈↓
␈↓The␈α
calculation␈α
of␈αtrajectories␈α
is␈α
time-consuming␈αbut␈α
not␈α
time-critical,␈αand␈α
servoing␈α
of␈α
devices␈αis
␈↓time-critical␈α∞but␈α∞not␈α∞especially␈α∂time-consuming.␈α∞ It␈α∞is␈α∞intended␈α∞that␈α∂HAL␈α∞be␈α∞usable␈α∞in␈α∂a␈α∞factory
␈↓environment,␈α∪with␈α∩perhaps␈α∪continual␈α∩execution␈α∪of␈α∪plans␈α∩at␈α∪many␈α∩work␈α∪stations.␈α∪ These␈α∩two
␈↓considerations␈α
lead␈α
us␈α
to␈α
the␈α
belief␈α
that␈α
planning␈α
should␈α
occur␈α
on␈α
a␈α
large␈α∞time-shared␈α
computer
␈↓(like␈α⊃a␈α⊃PDP-10),␈α∩whereas␈α⊃execution␈α⊃of␈α⊃plans␈α∩should␈α⊃take␈α⊃place␈α⊃under␈α∩the␈α⊃control␈α⊃of␈α∩a␈α⊃small
␈↓computer (like a PDP-11), many of which could be distributed in the work area.
␈↓The␈α∂runtime␈α⊂system␈α∂(which,␈α⊂as␈α∂just␈α⊂mentioned,␈α∂is␈α∂intended␈α⊂to␈α∂reside␈α⊂in␈α∂a␈α⊂minicomputer)␈α∂must
␈↓support␈α⊂simultaneous␈α⊂executions␈α⊂of␈α⊂several␈α⊂processes.␈α∂ Three␈α⊂basic␈α⊂types␈α⊂of␈α⊂process␈α⊂have␈α∂been
␈↓identified:␈α⊃Interpreters,␈α∩which␈α⊃do␈α⊃arithmetic,␈α∩servos,␈α⊃each␈α∩of␈α⊃which␈α⊃controls␈α∩one␈α⊃joint␈α∩of␈α⊃one
␈↓device,␈α∂and␈α∂monitors,␈α∂which␈α∂continually␈α∂examine␈α∞conditions.␈α∂ These␈α∂must␈α∂be␈α∂managed␈α∂in␈α∞some
␈↓(simple) scheme with guaranteed response for the latter two types of process.
␈↓There␈α⊗must␈α↔be␈α⊗enough␈α⊗information␈α↔available␈α⊗at␈α⊗runtime␈α↔for␈α⊗the␈α⊗proper␈α↔modification␈α⊗of
␈↓trajectories immediately before they are executed.
␈↓The␈α
system␈α
must␈α
be␈α
capable␈α
of␈α
using␈α
vision␈α
and␈α
other␈α
yet␈α
unpredictable␈α
forms␈α
of␈α
feedback.␈α
Vision
␈↓would␈α∪be␈α∪quite␈α∩useful␈α∪in␈α∪searching␈α∪for␈α∩objects␈α∪and␈α∪testing␈α∪for␈α∩adequacy␈α∪of␈α∪assembly.␈α∪It␈α∩is
␈↓conceivable␈α
that␈α
vision␈α
will␈α
be␈αused␈α
for␈α
the␈α
servoing␈α
of␈α
an␈αarm;␈α
this␈α
implies␈α
that␈α
vision␈α
must␈αbe␈α
in
␈↓the␈αfeedback␈αloop␈αduring␈αmotions␈αOther␈αdynamic␈αfeedback␈α(like␈αforce-sensing␈αwrists)␈α
could␈αmake
␈↓the␈α
capabilities␈α
of␈α
the␈α
arms␈α
much␈α
greater␈α∞in␈α
dealing␈α
with␈α
non-rigid␈α
materials␈α
like␈α
cloth␈α∞or␈α
rope.
␈↓What␈αis␈αneeded␈αis␈αa␈αway␈αof␈αspecifying␈αcalls␈αto␈αthese␈α"external"␈αdevices␈αso␈αthat␈αwhen␈αthey␈αbecome
␈↓available, they can be meshed into the system without much difficulty.
␈↓Page 4␈α?␈α?␈α?␈α?␈α?␈α?␈α≡PROGRAMMING AIDS␈↓ $2.3
␈↓␈↓∧2.3 PROGRAMMING AIDS␈↓
␈↓A␈αuser␈αshould␈αbe␈αable␈αto␈αcompile␈αa␈αpiece␈αof␈αcode,␈αtry␈αit␈αon␈αthe␈αspot,␈αand␈αdelete␈αor␈αreplace␈αsections
␈↓of previous code.
␈↓Error␈α∩recovery␈α∪facilities␈α∩are␈α∩very␈α∪important.␈α∩ A␈α∩user␈α∪should␈α∩be␈α∩able␈α∪to␈α∩recover␈α∪from␈α∩errors
␈↓discovered␈α∂during␈α⊂any␈α∂phase␈α∂of␈α⊂debugging.␈α∂ Similarly,␈α∂production␈α⊂programs␈α∂should␈α∂be␈α⊂able␈α∂to
␈↓request␈α∞operator␈α∞intervention␈α∞where␈α∞necessary␈α∞and␈α∞should␈α
(at␈α∞least)␈α∞be␈α∞able␈α∞to␈α∞be␈α∞restarted␈α∞at␈α
a
␈↓convenient place after the problem is fixed.
␈↓The␈α⊂compiler␈α⊂itself␈α⊂should␈α⊂make␈α⊂a␈α⊂great␈α⊂number␈α⊂of␈α⊂semantic␈α⊂checks,␈α⊂such␈α⊂as␈α⊂assuring␈α⊃that␈α⊂a
␈↓proposed␈αmotion␈αwill␈α
not␈αhit␈αsome␈α
object␈α(although␈αthis␈α
is␈αa␈αdifficult␈α
problem␈αwhich␈αhas␈α
not␈αyet
␈↓been␈α
satisfactorily␈α
solved)␈α
or␈α
that␈α
simultaneous␈α
independent␈α
motions␈α
are␈α
not␈α
being␈α
requested␈αfor
␈↓the same device.
␈↓The␈α∩user␈α∩should␈α⊃be␈α∩given␈α∩a␈α⊃wide␈α∩choice␈α∩of␈α⊃media␈α∩for␈α∩communication␈α⊃with␈α∩the␈α∩system.␈α⊃For
␈↓instance,␈αstatus␈αinformation␈αfrom␈αthe␈αarms␈αand␈αother␈αruntime␈αdevices␈αshould␈αbe␈αavailable␈αduring
␈↓the␈αcoding␈αprocess␈αitself␈αfor␈αthe␈αpurpose␈αof␈αsetting␈αconstants␈αand␈αfor␈αimplementation␈α
of␈α"learning
␈↓by␈α∩showing"␈α∩techniques.␈α∩ Similarly,␈α∩full␈α∩use␈α∩should␈α∩be␈α∩made␈α∩of␈α∩available␈α∪computer␈α∩graphics
␈↓hardware,␈αboth␈αas␈αa␈αmeans␈αfor␈αdepicting␈αthe␈αcompiler's␈αplanning␈αmodel␈αof␈αvarious␈αruntime␈αstates
␈↓and as another means of non-verbal input.
␈↓There␈αshould␈αbe␈αa␈αway␈α
to␈αinvestigate␈αthe␈αcontents␈αof␈α
the␈αruntime␈αsystem,␈αboth␈αvariables␈αand␈α
code,
␈↓in␈αorder␈αto␈αpatch␈αsimple␈αmistakes␈αdiscovered␈α
during␈αthe␈αcourse␈αof␈αa␈αproduction␈αrun.␈α This␈α
feature
␈↓would be especially useful for debugging the compiler.
␈↓␈↓∧2.4 SOPHISTICATED USE OF WORLD MODEL INFORMATION␈↓
␈↓The␈α
compiler␈α
should␈α
be␈α
able␈α
to␈α
maintain␈αa␈α
wide␈α
variety␈α
of␈α
information␈α
about␈α
expected␈αruntime
␈↓states.␈α⊗ This␈α⊗includes␈α⊗not␈α⊗only␈α⊗object␈α⊗attachments␈α⊗and␈α⊗variable␈α⊗planning␈α⊗values␈α⊗but␈α⊗also
␈↓information␈αlike␈αthe␈αaccuracy␈αwithin␈αwhich␈αthe␈αplanning␈αvalue␈αis␈αknown,␈αhow␈αheavy␈α
objects␈αare,
␈↓how␈αmany␈αfaces␈αan␈αobject␈αhas␈αon␈αwhich␈αit␈αcan␈αrest,␈αhow␈αwide␈αthe␈αfingers␈αof␈αan␈αarm␈αshould␈αopen
␈↓to␈αgrasp␈αit.␈α This␈αinformation␈αmay␈αcome␈αfrom␈αseveral␈αsources,␈αincluding␈αexplicit␈αassertions␈αby␈αthe
␈↓user,␈α⊂the␈α⊂output␈α⊂of␈α∂computer-aided␈α⊂design␈α⊂programs,␈α⊂and␈α∂built-in␈α⊂knowledge␈α⊂about␈α⊂the␈α∂system
␈↓hardware.
␈↓The␈αsystem␈αshould␈αprovide␈αa␈αnumber␈αof␈αexplicit␈αmechanisms␈αfor␈αusing␈αthis␈αinformation,␈αranging
␈↓from␈αsimple␈αretrieval␈αof␈αdata␈αfrom␈α
the␈αcompile-time␈αmodel␈αto␈αconditional␈αcompilation␈α
facilities␈αto
␈↓produce␈α∂substantially␈α∞different␈α∂object␈α∂programs,␈α∞depending␈α∂on␈α∞the␈α∂planning␈α∂information.␈α∞ Such
␈↓facilities␈α⊂allow␈α∂the␈α⊂user␈α∂to␈α⊂write␈α∂a␈α⊂single␈α∂piece␈α⊂of␈α∂code␈α⊂in␈α∂some␈α⊂generality,␈α∂while␈α⊂avoiding␈α∂the
␈↓inefficiencies␈α∞of␈α
many␈α∞needless␈α∞runtime␈α
checks␈α∞and␈α
the␈α∞planning␈α∞of␈α
useless␈α∞trajectories␈α∞for␈α
cases
␈↓that will never be executed.
␈↓The␈αsystem␈αshould␈αinclude␈αenough␈αdomain-specific␈αknowledge␈αto␈αallow␈αprograms␈αto␈αbe␈αwritten␈αin
␈↓2.4␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α2WORLD MODEL␈↓
pPage 5
␈↓terms␈α∞of␈α∂common␈α∞assembly␈α∞operations,␈α∂rather␈α∞than␈α∂exclusively␈α∞in␈α∞terms␈α∂of␈α∞the␈α∂detailed␈α∞motions
␈↓required.␈α At␈αthe␈αsimplest␈αlevel,␈αthis␈αinvolves␈αprovision␈αof␈αa␈αlibrary␈αof␈αcommon␈αassembly␈α"macro-
␈↓operations"␈α
that␈α
can␈α
be␈α
conditionally␈α∞expanded␈α
to␈α
perform␈α
particular␈α
subtasks.␈α
Beyond␈α∞this,␈α
we
␈↓would␈αlike␈αan␈αinteractive␈αsystem␈αthat␈αcan␈αtake␈αa␈α"high␈αlevel"␈αdescription␈αof␈αan␈αassembly␈αalgorithm
␈↓and␈α∞fill␈α∞in␈α
many␈α∞of␈α∞the␈α∞detailed␈α
decisions␈α∞required␈α∞to␈α∞produce␈α
a␈α∞consistent␈α∞and␈α∞efficient␈α
output
␈↓program.
␈↓The␈α∞range␈α∞of␈α∞decisions␈α∞required␈α
to␈α∞do␈α∞this␈α∞is␈α∞quite␈α
broad,␈α∞and␈α∞many␈α∞of␈α∞the␈α∞processes␈α
involved
␈↓cannot␈α
be␈α
modelled␈αreadily␈α
in␈α
terms␈α
of␈αthe␈α
purely␈α
"local"␈αmechanisms␈α
used␈α
in␈α
expanding␈αlibrary
␈↓routines.␈α For␈αinstance,␈αa␈αcommand␈αlike␈α"put␈αthe␈α
engine␈αblock␈αon␈αthe␈αtable␈αin␈αan␈αupright␈α
position"
␈↓would␈αrequire␈αthe␈αsystem␈αto␈αexamine␈αfuture␈αoperations␈αon␈αthe␈αengine␈αblock␈αin␈αselecting␈αthe␈αexact
␈↓orientation␈α∞to␈α∞use.␈α∞ Similarly,␈α
many␈α∞operations␈α∞produce␈α∞side␈α
effects␈α∞that␈α∞make␈α∞other␈α∞tasks␈α
either
␈↓easier␈α∂or␈α⊂harder.␈α∂ For␈α∂instance,␈α⊂inserting␈α∂a␈α∂pin␈α⊂into␈α∂a␈α∂hole␈α⊂yields␈α∂information␈α∂about␈α⊂the␈α∂exact
␈↓location␈αof␈αthe␈αhole␈αand,␈αhence,␈αof␈αthe␈αobject␈αinto␈αwhich␈αthe␈αhole␈αhas␈αbeen␈αdrilled.␈α If␈αthere␈αare␈αa
␈↓number␈αof␈α
pins␈αto␈α
be␈αinserted,␈α
then␈αit␈α
may␈αbe␈αa␈α
good␈αidea␈α
to␈αinsert␈α
pins␈αinto␈α
the␈αeasier-to-locate
␈↓holes␈αfirst␈α
and␈αthen␈αto␈α
use␈αthe␈α
information␈αso␈αgained␈α
to␈αhelp␈αwith␈α
the␈αremaining␈α
insertions.␈α(On
␈↓the␈αother␈αhand,␈αsuch␈αan␈αordering␈αmay␈αvery␈αwell␈αmake␈αthe␈αactual␈αinsertions␈αmore␈αdifficult␈αbecause
␈↓of␈αobstructions␈α
to␈αthe␈αhand).␈α
The␈αsystem␈αshould␈α
be␈αable␈αto␈α
use␈αthese␈αsorts␈α
of␈αconsiderations␈α
as␈αit
␈↓goes about generating the output program.
␈↓A␈αuser␈αshould␈αbe␈αable␈αto␈αspecify␈αdifferent␈α
parts␈αof␈αa␈αtask␈αat␈αvarious␈αlevels␈αof␈αdetail.␈α
The␈αsystem
␈↓must␈α∩be␈α∪able␈α∩to␈α∪accept␈α∩explicit␈α∪advice␈α∩telling␈α∪exactly␈α∩how␈α∪some␈α∩particular␈α∪subtask␈α∩is␈α∪to␈α∩be
␈↓accomplished␈α∞and␈α∞then␈α∞complete␈α∞the␈α∞program␈α∞in␈α
a␈α∞way␈α∞that␈α∞does␈α∞not␈α∞conflict␈α∞with␈α∞those␈α
things
␈↓that␈αhave␈αbeen␈αexplicitly␈αspecified.␈α This␈αis␈α
especially␈αimportant␈αfor␈αearly␈αversions␈αof␈αHAL,␈α
which
␈↓are not likely to be very "smart" and will therefore require a fair amount of explicit help.
␈↓The␈α
user␈αshould␈α
be␈αable␈α
to␈α
describe␈αthe␈α
"intent"␈αof␈α
a␈αparticular␈α
piece␈α
of␈αcode,␈α
at␈αleast␈α
to␈αthe␈α
extent
␈↓of␈α⊃specifying␈α⊂any␈α⊃(non-obvious)␈α⊃prerequisites␈α⊂or␈α⊃updates␈α⊂to␈α⊃the␈α⊃world␈α⊂model.␈α⊃ This␈α⊃facility␈α⊂is
␈↓especially␈α⊂important␈α⊂for␈α⊃programs␈α⊂that␈α⊂mix␈α⊂both␈α⊃high␈α⊂and␈α⊂low-level␈α⊂primitives.␈α⊃Similarly,␈α⊂the
␈↓system␈α⊂should␈α⊂be␈α⊂able␈α⊂to␈α⊂show␈α⊂the␈α⊂user␈α⊂how␈α⊂it␈α⊂is␈α⊂filling␈α⊂in␈α⊂the␈α⊂details␈α⊂to␈α⊂produce␈α⊂an␈α∂output
␈↓program,␈α
and␈α
why.␈α
This␈α
is␈αvery␈α
important␈α
both␈α
for␈α
debugging␈αand␈α
for␈α
explaining␈α
to␈α
the␈αuser␈α
any
␈↓requests for advice that it must make.
␈↓Page 6␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α)HARDWARE␈↓ H
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0␈↓∧CHAPTER 3␈↓
␈↓␈α?␈α?␈α?␈α?␈α?␈α(␈↓¬GENERAL SYSTEM OUTLINE␈↓
␈↓␈↓∧3.1 HARDWARE␈↓
␈↓Currently␈α⊃two␈α⊂Stanford␈α⊃Electric␈α⊂Arms,␈α⊃built␈α⊂by␈α⊃Victor␈α⊂Scheinman␈α⊃[Scheinman],␈α⊃are␈α⊂available.
␈↓They␈α∞are␈α∞called␈α∞YELLOW␈α∞and␈α∂BLUE.␈α∞ Each␈α∞has␈α∞six␈α∞joints␈α∂and␈α∞a␈α∞hand␈α∞which␈α∞can␈α∂open␈α∞and
␈↓close.␈α The␈αjoints␈αare␈αcontrolled␈αby␈αelectrical␈αmotors;␈αthere␈αis␈αfeedback␈αof␈αposition␈αand␈αvelocity␈αfor
␈↓each␈αjoint.␈α The␈αmotor␈αdrives␈αare␈αcomputed␈αand␈αsent␈αto␈αthe␈αarm␈αvia␈αa␈αdigital-to-analog␈αconverter;
␈↓the feedback signals are routed through an analog-to-digital converter back to the computer.
␈↓There␈α∂are␈α∂two␈α∂computer-controlled␈α∂cameras.␈α∂The␈α∂computer␈α∂can␈α∂control␈α∂the␈α∂pan,␈α∂tilt,␈α∂focus,␈α∞iris,
␈↓filter, and zoom (or lens turret) on each camera.
␈↓Various␈α
others␈α
devices␈α
are␈α
designed␈α
and␈α
implemented␈αas␈α
needed.␈α
We␈α
use␈α
tools,␈α
jigs␈α
and␈αspecial
␈↓markings␈αfor␈αseveral␈αpurposes:␈αto␈αrender␈αa␈αtask␈α
possible␈α(an␈αexample␈αis␈αthe␈αarm␈αitself),␈αto␈α
improve
␈↓efficiency␈α⊂(the␈α⊂mechanical␈α⊂screwdriver),␈α⊂and␈α⊂to␈α⊂overcome␈α⊂some␈α⊂of␈α⊂our␈α⊂sensory␈α⊂and␈α∂mechanical
␈↓limitations␈α∃(the␈α∃screw␈α∃dispenser).␈α∃ Currently␈α∃there␈α∃is␈α∃an␈α∃electrically␈α∃powered␈α∃screwdriver,␈α∀a
␈↓pneumatic␈αvise,␈αand␈αan␈αelectrically␈αcontrolled␈αturntable.␈α The␈αscrewdriver␈αcan␈αbe␈αpicked␈αup␈αby␈αan
␈↓arm␈α
and␈αcan␈α
operate␈αin␈α
either␈αdirection␈α
over␈αa␈α
range␈α
of␈αspeeds.␈α
The␈αvise␈α
can␈αbe␈α
opened␈αor␈α
closed
␈↓and␈α
soon␈α
there␈αwill␈α
be␈α
a␈αway␈α
to␈α
servo␈αit␈α
to␈α
a␈αspecified␈α
opening.␈α
The␈αcomputer␈α
can␈α
position␈αthe
␈↓turntable␈αat␈αany␈αrotation␈α(plus␈αor␈αminus␈α.5␈α
degrees).␈α As␈αsuch␈αdevices␈αare␈αbuilt,␈αthey␈αare␈α
interfaced
␈↓to␈α∂the␈α∂A-to-D,␈α∂the␈α∂servo␈α∂is␈α∂told␈α∂how␈α∞to␈α∂control␈α∂them,␈α∂and␈α∂the␈α∂language␈α∂is␈α∂extended␈α∂to␈α∞include
␈↓syntax to describe how to use them.
␈↓HAL␈αresides␈αon␈αtwo␈αcomputers:␈αThe␈αPDP-10␈αfor␈αall␈αplanning,␈αand␈αa␈αPDP-11␈αfor␈αthe␈αexecution␈αof
␈↓the␈α∂plans.␈α∂ The␈α∞former␈α∂is␈α∂run␈α∞as␈α∂a␈α∂timesharing␈α∞computer␈α∂(under␈α∂a␈α∞modified␈α∂DEC␈α∂system);␈α∞the
␈↓latter␈α
is␈α
operated␈αin␈α
a␈α
stand-alone␈α
mode␈αunder␈α
the␈α
HAL␈α
runtime␈αsystem.␈α
Each␈α
computer␈αis␈α
capable
␈↓of␈α
generating␈α∞an␈α
interrupt␈α
in␈α∞the␈α
other,␈α
and␈α∞the␈α
PDP-10␈α
has␈α∞complete␈α
control␈α
over␈α∞the␈α
PDP-11
␈↓console and unibus.
␈↓␈↓∧3.2 SOFTWARE␈↓
␈↓See Figure 3.1 for a picture of the system.
␈↓The␈α⊂SUPERVISOR␈α⊂is␈α⊂the␈α⊂top␈α⊂level␈α⊂of␈α⊂the␈α⊂system.␈α⊂ It␈α⊂runs␈α⊂on␈α⊂the␈α⊂PDP-10␈α⊂and␈α⊂provides␈α∂an
␈↓interface␈αbetween␈αthe␈αuser␈αand␈αthe␈αother␈αparts␈αof␈αthe␈αsystem:␈α1)␈αlistening␈αto␈αthe␈αuser's␈αconsole␈αand
␈↓interpreting␈α⊃input␈α⊂in␈α⊃a␈α⊂special␈α⊃command␈α⊂language;␈α⊃2)␈α⊂controling␈α⊃the␈α⊂compiler,␈α⊃starting␈α⊃it␈α⊂and
␈↓relaying␈αits␈αerror␈αmessages␈αback␈αto␈αthe␈αuser;␈α
3)␈αsignalling␈αthe␈αloader␈αwhen␈αit␈αis␈αnecessary␈α
to␈αplace
␈↓compiled␈α
code␈α
into␈αthe␈α
PDP-11;␈α
4)␈αhandling␈α
the␈α
runtime␈αinterface␈α
to␈α
the␈αPDP11.␈α
Each␈α
of␈αthese
␈↓modules is discussed below.
␈↓3.2␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α⊗SOFTWARE␈↓
pPage 7
␈↓The␈α⊂USER␈α⊂sits␈α⊃at␈α⊂a␈α⊂console␈α⊂and␈α⊃makes␈α⊂requests␈α⊂of␈α⊂HAL.␈α⊃ These␈α⊂fall␈α⊂into␈α⊃several␈α⊂categories:
␈↓Compilation,␈α∂loading,␈α∂execution␈α∂of␈α∂programs,␈α∂debugging␈α∂of␈α∂code,␈α∂requesting␈α∂status␈α∞information,
␈↓asking␈α⊂for␈α⊂immediate␈α⊂arm␈α⊂motion,␈α⊂saving␈α⊂and␈α⊂restoring␈α⊂the␈α⊂state␈α⊂of␈α⊂the␈α⊂world␈α⊂at␈α⊂safe␈α⊂points,
␈↓requesting explanation of certain compiler decisions.
␈↓The␈αCOMPILER␈αreads␈αHAL␈αprograms␈αfrom␈αfiles␈α(or,␈αoptionally,␈αdirectly␈αfrom␈αthe␈αuser's␈αconsole)
␈↓and␈α∩produces␈α⊃load␈α∩modules.␈α∩ The␈α⊃compiler␈α∩is␈α⊃divided␈α∩into␈α∩three␈α⊃phases:␈α∩The␈α∩PARSER,␈α⊃the
␈↓EXPANDER,␈α
and␈αthe␈α
TRAJECTORY␈αCALCULATOR.␈α
The␈αcompiler␈α
is␈αdiscussed␈α
in␈α
detail␈αin
␈↓Section 4.1.
␈↓The␈αLOADER␈αtakes␈α
the␈αload␈αmodules␈αprepared␈α
by␈αthe␈αcompiler␈αand␈α
enters␈αthem␈αinto␈αthe␈α
PDP11
␈↓runtime␈αsystem.␈α Address␈αrelocation␈αand␈αlinking␈αare␈αdone␈αat␈αthis␈αtime.␈αThe␈αloader␈αalso␈αsets␈αup␈αthe
␈↓data␈α∂area␈α∂in␈α∂the␈α∂runtime␈α∂interface␈α∂in␈α∞the␈α∂PDP-10;␈α∂this␈α∂data␈α∂includes␈α∂output␈α∂strings,␈α∞procedure
␈↓linkages,␈α⊂and␈α⊂information␈α∂necessary␈α⊂for␈α⊂diagnostic␈α⊂purposes␈α∂during␈α⊂runtime.␈α⊂ Loading␈α⊂is␈α∂often
␈↓done in a partially incremental fashion, installing new code following previously loaded code.
␈↓The␈α_RUNTIME␈α_INTERFACE␈α↔is␈α_charged␈α_with␈α↔initiating␈α_the␈α_PDP-11␈α_program,␈α↔fielding
␈↓procedure␈α∂calls␈α∂from␈α∂the␈α∂running␈α∂HAL␈α∂program␈α∂to␈α∂PDP-10␈α∂procedures,␈α∂returning␈α∂values␈α∂from
␈↓these␈αprocedures,␈αinterrupting␈αthe␈αexecution␈αof␈α
a␈αprogram,␈αand␈αfetching␈αvalues␈αfrom␈α
the␈αPDP-11
␈↓for debugging purposes.
␈↓The␈α⊃RUNTIME␈α⊃SYSTEM␈α⊂is␈α⊃the␈α⊃set␈α⊃of␈α⊂programs␈α⊃which␈α⊃reside␈α⊂in␈α⊃the␈α⊃PDP11.␈α⊃ This␈α⊂system
␈↓includes␈αkernel␈α
programs␈αfor␈α
time-slice␈αcpu␈α
sharing␈αand␈αprocess␈α
control␈αand␈α
a␈αset␈α
of␈αdynamically
␈↓created␈α∂processes.␈α∂ These␈α∂are␈α∂of␈α∂three␈α∞basic␈α∂types:␈α∂a)␈α∂An␈α∂INTERPRETER␈α∂examines␈α∂the␈α∞tables
␈↓prepared␈αby␈αthe␈αcompiler␈αand␈αexecutes␈α
the␈αnumeric␈αcomputations␈αrequested.␈α When␈αa␈αmove␈α
is␈αto
␈↓be␈αstarted,␈αthe␈αinterpreter␈αsprouts␈αa␈αservo␈αfor␈αeach␈αjoint␈αand␈αwaits␈αuntil␈αall␈αthese␈αservos␈α
terminate.
␈↓b)␈α∃A␈α∀SERVO␈α∃handles␈α∀the␈α∃motion␈α∀of␈α∃one␈α∀moving␈α∃joint.␈α∀ c)␈α∃A␈α∀CONDITION-MONITOR
␈↓repeatedly␈α⊂examines␈α⊂certain␈α⊃conditions␈α⊂(whatever␈α⊂the␈α⊂programmer␈α⊃has␈α⊂specified).␈α⊂ If␈α⊃it␈α⊂should
␈↓discover␈α∞that␈α
its␈α∞condition␈α
is␈α∞satisfied,␈α∞it␈α
sprouts␈α∞an␈α
interpreter␈α∞to␈α
take␈α∞appropriate␈α∞action.␈α
The
␈↓runtime␈α⊂system␈α⊂also␈α∂includes␈α⊂routines␈α⊂for␈α⊂communication␈α∂with␈α⊂the␈α⊂(PDP-10)␈α⊂runtime␈α∂interface.
␈↓The runtime system is described in detail in Chapter 6 and Appendix II.
␈↓Page 8␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α-SOFTWARE␈↓ $3.2
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβFigure 3.1
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α(Overall system
␈↓3.2␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α⊗SOFTWARE␈↓
pPage 9
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α/␈↓∧CHAPTER 4␈↓
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α↓␈↓¬SOURCE LANGUAGE␈↓
␈↓The␈α
following␈α
is␈α
a␈α
description␈αof␈α
the␈α
source␈α
language␈α
of␈αHAL.␈α
We␈α
will␈α
discuss␈α
the␈α
structure␈αof
␈↓the␈α⊂compiler,␈α⊂and␈α⊂then␈α⊂these␈α⊂areas␈α⊃of␈α⊂the␈α⊂language:␈α⊂control␈α⊂structures,␈α⊂data␈α⊃structures,␈α⊂motion
␈↓specifications, and various compile time constructs.
␈↓␈↓∧4.1 THE HAL COMPILER␈↓
␈↓The␈αHAL␈αcompiler␈αis␈αbuilt␈αof␈αthree␈αparts:␈αthe␈αparser,␈αthe␈αexpander,␈αand␈αthe␈αtrajectory␈αcalculator.
␈↓These are depicted in Figure 4.1.
␈↓␈↓β4.1.1 PARSER␈↓
␈↓The␈α
PARSER␈α
reads␈α
source␈α∞code␈α
from␈α
either␈α
the␈α∞console␈α
or␈α
a␈α
file.␈α∞ Its␈α
purpose␈α
is␈α
to␈α∞form␈α
parse
␈↓trees␈α∞and␈α∂do␈α∞some␈α∞simple␈α∂manipulations,␈α∞such␈α∞as␈α∂assigning␈α∞line␈α∞numbers,␈α∂causing␈α∞listings␈α∂to␈α∞be
␈↓directed␈α⊃to␈α⊃the␈α⊃appropriate␈α⊃file␈α⊃(if␈α∩desired),␈α⊃expanding␈α⊃text␈α⊃macros,␈α⊃and␈α⊃keeping␈α∩a␈α⊃primitive
␈↓symbol␈αtable.␈α
If␈αa␈α
syntax␈αerror␈α
is␈αdiscovered,␈αit␈α
informs␈αthe␈α
supervisor,␈αwhich␈α
will␈αgive␈α
the␈αuser
␈↓several␈α∂options,␈α∂including␈α∂aborting␈α∂the␈α⊂compilation,␈α∂making␈α∂local␈α∂modifications␈α∂on␈α∂the␈α⊂spot,␈α∂or
␈↓switching␈α
temporarily␈αto␈α
a␈α
text␈αeditor.␈α
In␈α
many␈αcases,␈α
control␈α
will␈αbe␈α
returned␈α
to␈αthe␈α
parser,␈αand␈α
it
␈↓will continue to create parse trees from the input.
␈↓␈↓β4.1.2 EXPANDER ␈↓
␈↓The␈α∩EXPANDER␈α∪shares␈α∩with␈α∪the␈α∩trajectory␈α∪calculator␈α∩the␈α∪responsibility␈α∩for␈α∪turning␈α∩parser
␈↓output␈αinto␈αcode␈αinterpretable␈αby␈αthe␈αruntime␈αsystem.␈α Its␈αmain␈αfunctions␈αare␈αto␈αmaintain␈αa␈αmodel
␈↓of␈α∞the␈α∞expected␈α∞runtime␈α∞state␈α∞at␈α∞each␈α∞point␈α∂in␈α∞the␈α∞program␈α∞and␈α∞to␈α∞use␈α∞this␈α∞model␈α∞to␈α∂resolve␈α∞a
␈↓number␈α
of␈αcompile-time␈α
decisions.␈α The␈α
information␈αkept␈α
includes␈αexpected␈α
variable␈αvalues,␈α
object
␈↓descriptions,␈α∞relations␈α∞between␈α∞objects,␈α∞endpoint␈α∞constraints␈α∞on␈α∞particular␈α∞trajectories,␈α∞and␈α∞much
␈↓more.␈α∞ Simple␈α∞uses␈α∞of␈α
this␈α∞information␈α∞include␈α∞providing␈α
the␈α∞trajectory␈α∞calculator␈α∞with␈α
essential
␈↓data␈α⊂and␈α⊂resolving␈α⊂conditional␈α⊂compilation␈α∂requests.␈α⊂ Beyond␈α⊂this,␈α⊂the␈α⊂expander␈α⊂has␈α∂principal
␈↓responsibility␈α∂for␈α∂filling␈α∞in␈α∂the␈α∂details␈α∂required␈α∞to␈α∂turn␈α∂calls␈α∞on␈α∂various␈α∂high␈α∂and␈α∞intermediate
␈↓level␈α∞primitives␈α∞into␈α∞runnable␈α∞manipulation␈α∞programs.␈α∞ It␈α∞therefore␈α∞contains␈α∞a␈α∞number␈α∂of␈α∞quite
␈↓specialized␈α∂routines␈α∂with␈α∂considerable␈α∂knowledge␈α∂about␈α∂the␈α∂domain␈α∂of␈α∂mechanical␈α∂assembly,␈α∂as
␈↓well as a number of more general mechanisms for coordinating the specialists.
␈↓The␈α
expander␈α
supplies␈α
to␈α
the␈αtrajectory␈α
calculator␈α
a␈α
structure␈α
which␈αis␈α
very␈α
similar␈α
to␈α
the␈αparse
␈↓trees it accepts as input. However, no choices are left; all values have been explicitly specified.
␈↓Page 10␈α?␈α?␈α?␈α?␈α?␈α?␈α#THE HAL COMPILER␈↓ ∂4.1.3
␈↓␈↓β4.1.3 TRAJECTORY CALCULATOR␈↓
␈↓The␈α∩TRAJECTORY␈α∩CALCULATOR␈α∩takes␈α∪the␈α∩expanded␈α∩code␈α∩and␈α∩computes␈α∪the␈α∩required
␈↓trajectories␈αfor␈αthe␈αarms.␈α Tables␈αof␈αinterpretable␈αcode␈αare␈αgenerated␈αfor␈αhandling␈αarithmetic␈αand
␈↓assignment␈α
operations,␈αcondition␈α
monitoring,␈α
and␈αgraph-structure␈α
building␈α
operations␈α(the␈α
runtime
␈↓system␈α∩keeps␈α∩track␈α∩of␈α∩physical␈α∩attachment␈α⊃of␈α∩objects).␈α∩ For␈α∩motions,␈α∩detailed␈α∩instructions␈α⊃are
␈↓emitted␈α
specifying␈α
how␈αeach␈α
joint␈α
of␈αeach␈α
arm␈α
is␈αto␈α
behave,␈α
what␈αcomputations␈α
to␈α
make␈α
at␈αrun-
␈↓time␈αfor␈αthe␈αmodification␈αof␈αthese␈αtrajectories␈αto␈αbring␈αthem␈αinto␈αcorrespondence␈αwith␈αthe␈αcurrent
␈↓state␈α
of␈α
the␈α
world␈α
(for␈α
it␈α
happens␈α
often␈α
that␈α
objects␈α
are␈α
not␈α
exactly␈α
where␈α
they␈α
were␈α
planned␈αto
␈↓be), and what conditions to monitor during the motion.
␈↓The␈αtrajectory␈αcalculator␈α
also␈αis␈αused␈α
to␈αprovide␈αinformation␈α
to␈αthe␈αexpander.␈α
For␈αinstance,␈αit␈α
can
␈↓predict␈α
the␈α
runtime␈α
effects␈αof␈α
a␈α
given␈α
modification␈α
of␈αa␈α
planned␈α
trajectory.␈α
This␈α
information␈αis
␈↓useful␈αto␈αthe␈αexpander␈αin␈αdeciding␈αhow␈αmany␈α"different"␈αtrajectories␈αmust␈αbe␈αplanned␈αfor␈αa␈αgiven
␈↓motion␈α∂request.␈α∞ There␈α∂are␈α∂several␈α∞errors␈α∂which␈α∞the␈α∂trajectory␈α∂calculator␈α∞can␈α∂detect.␈α∂ A␈α∞request
␈↓might␈αtake␈αthe␈αarm␈αoutside␈αits␈αrange,␈αor␈αforce␈αa␈αjoint␈αto␈αexceed␈αits␈αvelocity␈αlimits.␈α It␈αmay␈α
discover
␈↓that␈αthere␈αis␈αa␈αpossibility␈αof␈αcollision␈αbetween␈αthe␈αtwo␈αarms,␈αor␈αbetween␈αthe␈αarm␈αand␈αsome␈αobject
␈↓on␈α
the␈αtable.␈α
In␈αorder␈α
to␈αcarry␈α
out␈αthese␈α
tests,␈αit␈α
may␈αrequest␈α
assurance␈αfrom␈α
the␈αuser␈α
that␈αsome
␈↓object␈α
lies␈αwithin␈α
a␈αcertain␈α
region,␈αor␈α
it␈α
may␈αgive␈α
the␈αuser␈α
a␈αwarning.␈α
The␈αworld␈α
model␈α
is␈αused
␈↓for␈α∞much␈α∞of␈α∂this␈α∞calculation.␈α∞ At␈α∂its␈α∞discretion,␈α∞the␈α∞trajectory␈α∂calculator␈α∞may␈α∞make␈α∂some␈α∞critical
␈↓motions very slow, so that an impending collision will be detected before it happens.
␈↓The output of the trajectory calculator is stored in binary files, for loading into the PDP11.
␈↓4.1.3␈α?␈α?␈α?␈α?␈α?␈α?␈α;THE HAL COMPILER␈↓
aPage 11
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβFigure 4.1
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α
The HAL compiler
␈↓Page 12␈α?␈α?␈α?␈α?␈α?␈α?␈α#THE HAL COMPILER␈↓ ∂4.1.3
␈↓␈↓∧4.2 CONTROL STRUCTURES␈↓
␈↓␈↓β4.2.1 TRADITIONAL ALGOL STRUCTURES␈↓
␈↓HAL␈α
has␈α
many␈α
of␈α
the␈α
traditional␈α
ALGOL␈α
control␈α
structures,␈α
including␈α
the␈α
statement,␈α
the␈αblock,
␈↓the␈α∂IF-THEN-ELSE␈α∂conditional,␈α⊂the␈α∂WHILE␈α∂loop,␈α⊂the␈α∂FOR␈α∂loop,␈α⊂and␈α∂the␈α∂GOTO␈α⊂(which␈α∂in
␈↓HAL␈α∞is␈α
written␈α∞JUMP.␈α∞JUMPs␈α
will␈α∞not␈α
be␈α∞implemented␈α∞at␈α
first,␈α∞because␈α
they␈α∞confuse␈α∞the␈α
flow
␈↓analysis␈α∞needed␈α∞for␈α
maintaining␈α∞planning␈α∞values␈α
and␈α∞because␈α∞it␈α
is␈α∞possible␈α∞to␈α∞accomplish␈α
much
␈↓without␈α∃them).␈α∃ The␈α∃simple␈α∃statement␈α∃can␈α∃be␈α∃of␈α∃several␈α∃varieties:␈α⊗Assignment,␈α∃declaration,
␈↓manipulation, assertions, condition monitoring. The assignment statement is of the general form
␈↓ FROB ← A + (2,0,0) ,
␈↓that␈α∩is,␈α∩a␈α⊃variable␈α∩name,␈α∩a␈α∩left␈α⊃arrow,␈α∩and␈α∩a␈α∩suitable␈α⊃expression.␈α∩ The␈α∩types␈α∩of␈α⊃expressions
␈↓available␈αwill␈αbe␈αdiscussed␈αunder␈αthe␈αrubric␈αof␈αdata␈αtypes.␈α Declarations␈αare␈αallowed␈αanywhere␈αin
␈↓the␈α
code␈α∞that␈α
other␈α∞statements␈α
are␈α
allowed;␈α∞this␈α
facilitates␈α∞typing␈α
in␈α
a␈α∞program␈α
from␈α∞a␈α
terminal.
␈↓Manipulation,␈αthe␈αfundamental␈αpurpose␈αof␈αHAL,␈αwill␈αbe␈αdiscussed␈αfully␈αin␈αthe␈αsection␈αon␈αmotion
␈↓specifications.␈α⊃ Assertions␈α⊂are␈α⊃discussed␈α⊃in␈α⊂subsection␈α⊃4.7.1.␈α⊂ Condition␈α⊃monitoring␈α⊃is␈α⊂discussed
␈↓in subsection 4.2.5.
␈↓A␈α
block␈α
is␈α
a␈α
list␈αof␈α
statements␈α
separated␈α
by␈α
semicolons,␈αprefaced␈α
by␈α
the␈α
reserved␈α
word␈αBEGIN␈α
and
␈↓closed␈αby␈αthe␈αreserved␈αword␈αEND.␈α Blocks␈αare␈α
used␈αto␈αenclose␈αa␈αgroup␈αof␈αstatements␈αto␈αform␈α
what
␈↓syntactically␈αcan␈αact␈αas␈αone␈αstatement,␈αand␈αprovide␈αa␈αmeans␈αfor␈αkeeping␈αvariables␈αlocal␈αto␈αa␈αpiece
␈↓of␈αcode.␈α It␈αis␈αpossible␈αto␈αname␈αa␈αblock␈αby␈αinserting␈αits␈αname␈αas␈αa␈αstring␈αafter␈αthe␈αBEGIN;␈αthis␈αis
␈↓useful␈α
as␈α
a␈α
comment,␈α
and␈α
during␈α
debugging␈α
provides␈αa␈α
way␈α
to␈α
name␈α
blocks␈α
of␈α
code.␈α
When␈αa␈α
block
␈↓is␈αso␈αnamed,␈αthe␈αname␈αshould␈αbe␈αrepeated␈αimmediately␈αafter␈αthe␈αEND;␈αthis␈αprovides␈αan␈αeasy␈αway
␈↓to insure proper matching of BEGINs and ENDs. An example:
␈↓ BEGIN "SAMPLE"
␈↓ SCALAR A, I;
␈↓ A ← 2;
␈↓ FOR I ← 1 STEP 1 UNTIL 10 DO A ← A*A;
␈↓ WHILE A > 0 DO
␈↓ BEGIN "LOOP"
␈↓ A ← A - 1;
␈↓ IF A < 5 THEN WRITE(A) ELSE WRITE(A-5)
␈↓ END "LOOP";
␈↓ WRITE("DONE")
␈↓ END "SAMPLE"
␈↓4.2.2␈α?␈α?␈α?␈α?␈α?␈α?␈α≤CONTROL STRUCTURES␈↓
aPage 13
␈↓␈↓β4.2.2 COBEGIN-COEND␈↓
␈↓In␈α∃addition␈α∀to␈α∃these␈α∃traditional␈α∀structures,␈α∃there␈α∀are␈α∃also␈α∃some␈α∀special␈α∃ones␈α∃for␈α∀specifying
␈↓simultaneous␈α∂independent␈α∂execution.␈α∂ The␈α∂principal␈α∞device␈α∂for␈α∂this␈α∂is␈α∂the␈α∞COBEGIN-COEND
␈↓pair,␈α∞which␈α∞brackets␈α∂statements␈α∞whose␈α∞execution␈α∂is␈α∞meant␈α∞to␈α∂begin␈α∞independently.␈α∞ Each␈α∂of␈α∞the
␈↓statements␈α
within␈α
the␈α
COBEGIN␈α
block␈αwill␈α
eventually␈α
get␈α
executed,␈α
with␈α
whatever␈αoverlapping␈α
of
␈↓execution␈αmight␈αoccur␈α
during␈αruntime␈α(for␈α
example,␈αwhile␈αone␈α
arm␈αis␈αmoving,␈α
another␈αstatement
␈↓can␈α∞be␈α∞computing;␈α∞several␈α∞arms␈α∞can␈α∞also␈α∞work␈α∞at␈α∞the␈α∞same␈α∞time).␈α∞The␈α∞termination␈α∞of␈α∞the␈α
block
␈↓occurs only when each of the statements in the scope of the COBEGIN has terminated.
␈↓␈↓β4.2.3 PARTIAL ORDERING OF SUBTASKS␈↓
␈↓An␈α∞assembly␈α∞task␈α
is␈α∞often␈α∞divided␈α
into␈α∞subtasks␈α∞which␈α
form␈α∞a␈α∞partial␈α
order␈α∞with␈α∞respect␈α∞to␈α
the
␈↓order␈α∞of␈α∞execution.␈α∞ An␈α∂example␈α∞is␈α∞a␈α∞task␈α∂A␈α∞which␈α∞contains␈α∞four␈α∞subtasks,␈α∂B,␈α∞C,␈α∞D,␈α∞and␈α∂E,␈α∞of
␈↓which␈α
B␈α
and␈α∞C␈α
must␈α
be␈α∞done␈α
before␈α
D,␈α
and␈α∞D␈α
must␈α
be␈α∞done␈α
before␈α
E,␈α
but␈α∞B␈α
and␈α
C␈α∞could␈α
be
␈↓done␈αin␈α
any␈αorder.␈α
It␈αis␈α
possible␈αin␈α
HAL␈αto␈α
leave␈αthe␈α
ordering␈αof␈α
the␈αsubtasks␈α
up␈αto␈αthe␈α
compiler,
␈↓which␈αwill␈α
try␈αto␈αoptimize␈α
the␈αentire␈αoperation.␈α
The␈αway␈αto␈α
specify␈αthe␈αexample␈α
just␈αgiven␈α
is␈αas
␈↓follows:
␈↓ TASK BEGIN "A"
␈↓ BEGIN "B"
␈↓ <code for task B>
␈↓ END "B";
␈↓ BEGIN "C"
␈↓ <code for task C>
␈↓ END "C";
␈↓ BEGIN "D AND E"
␈↓ PREREQUISITE "B", "C";
␈↓ <code for task D>
␈↓ <code for task E>
␈↓ END "D AND E"
␈↓ END "A"
␈↓The␈α∞words␈α∞TASK␈α∞BEGIN␈α∞introduce␈α∞a␈α∞"task␈α∞block",␈α∞which␈α∞contains␈α∞a␈α∞set␈α∞of␈α∂statements.␈α∞ These
␈↓statements␈αmay␈αbe␈αblocks␈αidentified␈αby␈αstrings␈αand␈αmay␈αcontain␈αthe␈αdeclaration␈αthat␈αcertain␈αother
␈↓named blocks within the same task are prerequisite for the inception of this block.
␈↓The␈α
order␈α
in␈α
which␈α
the␈α
statements␈α
are␈α
performed␈α
is␈α
determined␈α
only␈α
insofar␈α
as␈α
the␈α
prerequisite
␈↓conditions␈αdemand.␈α The␈αcompiler␈αmay␈αreorder␈αthem␈αconsistently␈αwith␈αthe␈αpreconditions,␈αand␈αmay
␈↓even␈α⊂execute␈α∂some␈α⊂of␈α∂the␈α⊂statements␈α∂simultaneously␈α⊂(as␈α∂if␈α⊂there␈α∂were␈α⊂a␈α∂COBEGIN),␈α⊂if␈α⊂this␈α∂is
␈↓feasible.
␈↓It␈α
is␈αuseful␈α
to␈αplace␈α
assertions␈αat␈α
the␈αbeginning␈α
of␈αthe␈α
code␈αfor␈α
any␈αof␈α
the␈αstatements␈α
within␈αa␈α
task;
␈↓Page 14␈α?␈α?␈α?␈α?␈α?␈α?␈α∧CONTROL STRUCTURES␈↓ ∂4.2.3
␈↓this␈α
assists␈αthe␈α
compiler␈α
in␈αmaintaining␈α
its␈α
world␈αmodel,␈α
and␈α
is␈αalso␈α
used␈α
to␈αhelp␈α
decide␈αthe␈α
proper
␈↓ordering␈α∪of␈α∪the␈α∪tasks.␈α∪It␈α∩is␈α∪likewise␈α∪good␈α∪to␈α∪place␈α∩assertions␈α∪at␈α∪the␈α∪end␈α∪of␈α∪each␈α∩statement.
␈↓(Assertions are discussed in subsection 4.7.1.)
␈↓␈↓β4.2.4 EVENTS: SIGNAL AND WAIT␈↓
␈↓To␈α⊂achieve␈α⊂simultaneous␈α∂coordinated␈α⊂motion,␈α⊂one␈α∂uses␈α⊂a␈α⊂special␈α∂form␈α⊂of␈α⊂the␈α⊂move␈α∂commands
␈↓which␈α∩will␈α∪be␈α∩discussed␈α∪later.␈α∩ However,␈α∩some␈α∪simple␈α∩synchronization␈α∪is␈α∩possible␈α∪within␈α∩the
␈↓context␈α∞of␈α∞simultaneous␈α∞execution.␈α∞ This␈α∞is␈α∞achieved␈α
by␈α∞means␈α∞of␈α∞explicit␈α∞events,␈α∞which␈α∞can␈α
be
␈↓signaled␈α∂and␈α∂awaited.␈α∂ For␈α∂every␈α∂type␈α∂of␈α∂event␈α∂that␈α∂the␈α∂user␈α∂wishes␈α∂to␈α∂use,␈α∂there␈α∂should␈α∂be␈α∂a
␈↓declaration something like:
␈↓ EVENT E1, E2, E3 .
␈↓Each␈α
event␈αinitially␈α
has␈α
count␈α0,␈α
that␈αis,␈α
no␈α
signals␈αhave␈α
appeared␈αfor␈α
it,␈α
and␈αno␈α
process␈αis␈α
waiting
␈↓for it. The statement
␈↓ SIGNAL E1
␈↓increments␈αthe␈αcount␈αassociated␈αwith␈αevent␈αE1,␈αand␈αif␈αthe␈αresulting␈αcount␈αis␈α0␈αor␈αnegative,␈αone␈αof
␈↓those processes waiting for E1 is freed from its wait and readied for execution. The statement
␈↓ WAIT E1
␈↓decrements␈αthe␈αcount␈αassociated␈αwith␈αevent␈αE1,␈αand␈αif␈αthe␈αresulting␈αcount␈αis␈αnegative,␈αthe␈αprocess
␈↓issuing␈α∞the␈α∞WAIT␈α∞is␈α∂blocked␈α∞from␈α∞continuing␈α∞until␈α∂a␈α∞signal␈α∞comes␈α∞along.␈α∂ If␈α∞the␈α∞count␈α∞is␈α∂0␈α∞or
␈↓positive, there is no waiting.
␈↓An␈α⊃example␈α⊂of␈α⊃the␈α⊂utility␈α⊃of␈α⊂this␈α⊃construct␈α⊃is␈α⊂inside␈α⊃a␈α⊂COBEGIN␈α⊃block,␈α⊂where␈α⊃one␈α⊃path␈α⊂of
␈↓execution␈αrequires␈αthat␈αthe␈αother␈αpath␈αhas␈αpassed␈αsome␈αmilestone.␈α Here␈αis␈αhow␈αsuch␈αa␈αuse␈αmight
␈↓appear:
␈↓ EVENT MILESTONE;
␈↓ COBEGIN
␈↓ BEGIN "PATH 1"
␈↓ <code before the critical point>
␈↓ WAIT MILESTONE;
␈↓ <code after the critical point>
␈↓ END "PATH 1";
␈↓ BEGIN "PATH 2"
␈↓ <code in preparation for the milestone>
␈↓ SIGNAL MILESTONE;
␈↓ <code following the milestone>
␈↓ END "PATH 2"
␈↓ COEND
␈↓4.2.5␈α?␈α?␈α?␈α?␈α?␈α?␈α≤CONTROL STRUCTURES␈↓
aPage 15
␈↓␈↓β4.2.5 ON MONITORS␈↓
␈↓It␈αis␈αoften␈αdesired␈αto␈αmonitor␈αsome␈αset␈αof␈αconditions␈αthroughout␈αa␈αsection␈αof␈αcode.␈α A␈αspecial␈αkind
␈↓of statement which allows the user to do this is the ON statement. A simple example is
␈↓ ON T >5 DO STOP YELLOW
␈↓which␈αwhile␈α
active␈αwill␈αmonitor␈α
the␈αmagnitude␈αof␈α
T␈αand␈αif␈α
it␈αshould␈αbecome␈α
greater␈αthan␈α
5␈αwill
␈↓cause␈α⊃the␈α⊃yellow␈α⊃arm␈α⊃to␈α⊃stop,␈α⊃if␈α⊃it␈α⊂is␈α⊃moving.␈α⊃ An␈α⊃ON␈α⊃monitor␈α⊃has␈α⊃two␈α⊃states:␈α⊃enabled␈α⊂and
␈↓disabled.␈αGenerally,␈αan␈αON␈αmonitor␈αwill␈αbe␈αenabled␈αas␈αsoon␈αas␈αits␈αdefining␈αstatement␈αis␈αexecuted,
␈↓and␈α∂it␈α∂becomes␈α∂disabled␈α∂when␈α∂its␈α∂block␈α∂is␈α∂exited.␈α∂Also,␈α∂as␈α∂soon␈α∂as␈α∂an␈α∂ON␈α∂monitor␈α⊂triggers,␈α∂it
␈↓becomes␈α∪disabled␈α∪until␈α∪explicitly␈α∪reenabled.␈α∪ Reenabling␈α∪is␈α∪done␈α∪by␈α∪executing␈α∀the␈α∪statement
␈↓ENABLE␈αwithin␈αthe␈αconclusion␈α
(that␈αis,␈αthe␈αstatement␈αfollowing␈α
the␈αDO).␈α It␈αis␈αpossible␈α
to␈αname
␈↓ON␈α∞monitors;␈α∞a␈α
monitor␈α∞named␈α∞"CH"␈α
will␈α∞be␈α∞enabled␈α
when␈α∞a␈α∞statement␈α
of␈α∞the␈α∞form␈α
ENABLE
␈↓"CH"␈α
is␈α
executed,␈αand␈α
is␈α
disabled␈α
either␈αunder␈α
the␈α
conditions␈α
named␈αabove␈α
or␈α
when␈α
it␈αis␈α
explicitly
␈↓turned␈αoff␈αby␈αa␈αDISABLE␈αstatement.␈α To␈α
have␈αan␈αON␈αmonitor␈αinitially␈αdisabled,␈αpreface␈αthe␈α
ON
␈↓with the word DEFER.
␈↓The␈α∂condition␈α∂which␈α∂is␈α∂being␈α∂tested␈α∂must␈α∞be␈α∂a␈α∂simple␈α∂numeric␈α∂inequality␈α∂or␈α∂equality,␈α∞possibly
␈↓using␈α⊗some␈α⊗continually␈α⊗evaluated␈α↔function.␈α⊗ Boolean␈α⊗combinations␈α⊗are␈α⊗not␈α↔allowed.␈α⊗ Some
␈↓examples of ON monitors:
␈↓ "FUDGE" ON TEMPERATURE > 400 DO WRITE("BURNING");
␈↓ DEFER "WAIT" ON COOKED = 1 DO DISABLE "FUDGE";
␈↓ ON MARK > 3 DO ENABLE "WAIT";
␈↓It␈α
should␈α
be␈α
noted␈α∞that␈α
this␈α
ability␈α
to␈α
enable␈α∞and␈α
disable␈α
monitors␈α
explicitly␈α
is␈α∞a␈α
non-structured
␈↓concept;␈α⊂using␈α⊃it␈α⊂will␈α⊃often␈α⊂lead␈α⊃to␈α⊂unintelligible␈α⊃programs.␈α⊂ In␈α⊃any␈α⊂case,␈α⊃scope␈α⊂rules␈α⊃must␈α⊂be
␈↓observed;␈α∞it␈α∞is␈α∞not␈α∞legal␈α∞to␈α∞enable␈α∞or␈α∂disable␈α∞a␈α∞monitor␈α∞in␈α∞a␈α∞parallel␈α∞or␈α∞subsidiary␈α∂block.␈α∞ This
␈↓means␈αthat␈αtwo␈αstatements,␈αsimultaneously␈αexecuting␈α
inside␈αa␈αCOBEGIN␈αblock,␈αare␈αnot␈αallowed␈α
to
␈↓interfere␈α∀with␈α∀each␈α∀other's␈α∀ON␈α∀monitors.␈α∀ The␈α∀conclusion␈α∀of␈α∀an␈α∀ON-monitor␈α∀may␈α∀be␈α∀any
␈↓statement,␈αincluding␈αan␈αentire␈αblock.␈α The␈αonly␈αrestriction␈αis␈αthat␈αif␈αa␈αmotion␈αstatement␈αis␈αthe␈αonly
␈↓statement␈α
in␈α∞the␈α
conclusion,␈α∞it␈α
must␈α∞be␈α
surrounded␈α∞by␈α
BEGIN␈α∞and␈α
END.␈α∞ (This␈α
is␈α∞necessary␈α
at
␈↓times to prevent ambiguity.) Here is a slightly more complex example:
␈↓ ON DURATION > 5 DO
␈↓ BEGIN
␈↓ "BIND" ON FORCE(Z)>10 DO STOP YELLOW;
␈↓ ON DIST > 3 DO
␈↓ BEGIN
␈↓ DISABLE BIND;
␈↓ VEL ← 40
␈↓ END
␈↓ END
␈↓The␈αexistence␈αof␈αON␈αmonitors␈αraises␈αthis␈αquestion:␈α
When␈αis␈αa␈αblock␈αconsidered␈αto␈αbe␈αfinished?␈α
It
␈↓Page 16␈α?␈α?␈α?␈α?␈α?␈α?␈α∧CONTROL STRUCTURES␈↓ ∂4.2.5
␈↓can␈α
happen␈α
that␈α
all␈αthe␈α
executable␈α
statements␈α
have␈α
finished,␈αbut␈α
some␈α
ON␈α
monitors␈αremain.␈α
This
␈↓situation␈α⊂is␈α⊂often␈α∂sterile;␈α⊂nothing␈α⊂can␈α⊂happen␈α∂unless␈α⊂one␈α⊂of␈α∂the␈α⊂conditions␈α⊂happens␈α⊂to␈α∂trigger,
␈↓which␈α
may␈α
or␈αmay␈α
not␈α
ever␈αoccur.␈α
Therefore,␈α
a␈αblock␈α
is␈α
declared␈αfinished␈α
when␈α
no␈αinterpreters
␈↓(that␈α∞is,␈α∞pieces␈α∞of␈α∞straightforward␈α∞code,␈α∞exclusive␈α∞of␈α∞on-monitors)␈α∞remain␈α∞active␈α∞within␈α∞it.␈α
This
␈↓means␈αthat␈αif␈α
even␈αone␈αON␈α
monitor␈αhas␈αcaused␈α
an␈αinterpreter␈αto␈α
start␈αexecuting␈α(to␈α
perform␈αthe
␈↓statements␈α∞in␈α∞the␈α∞conclusion),␈α∞then␈α∞the␈α∞block␈α∞is␈α∞not␈α∞exited␈α∞until␈α∞that␈α∞interpreter␈α∞is␈α∞done.␈α∞ But␈α
a
␈↓block may be exited while some ON monitors are still enabled; this automatically disables them.
␈↓The␈α∞user␈α∂must␈α∞be␈α∞wary␈α∂of␈α∞the␈α∂relative␈α∞speeds␈α∞at␈α∂which␈α∞her␈α∂various␈α∞pieces␈α∞of␈α∂code␈α∞in␈α∂ON␈α∞test
␈↓conclusions␈α∪get␈α∪executed.␈α∪ When␈α∀an␈α∪ON␈α∪test␈α∪triggers,␈α∀any␈α∪initial␈α∪statements␈α∪of␈α∀enabling␈α∪or
␈↓disabling␈αare␈α
done␈αimmediately,␈αbut␈α
any␈αarithmetic␈α
is␈αscheduled␈αto␈α
be␈αdone␈αat␈α
some␈αpoint␈α
in␈αthe
␈↓near␈α∀future.␈α∀ Therefore␈α∀it␈α∀is␈α∀not␈α∀possible␈α∀to␈α∀guarantee␈α∀that␈α∀a␈α∀critical␈α∀computation␈α∀happen
␈↓immediately.␈α If␈αthe␈αuser␈αdesires,␈αshe␈αmay␈αuse␈αthe␈αword␈αCRITICAL␈αat␈αthe␈αstart␈αof␈αthe␈αconclusion,
␈↓and␈αUNCRITICAL␈αat␈αthe␈αstart␈αof␈αthat␈αcode␈αwhich␈αneed␈αnot␈αbe␈αguaranteed␈αimmediate␈αexecution.
␈↓Only␈α
one␈α
occurrence␈α
of␈α
CRITICAL,␈α
at␈α
the␈α
very␈α
start␈α
of␈α
the␈α
conclusion,␈α
and␈α
only␈α
one␈α
occurrence␈α
of
␈↓UNCRITICAL␈α⊗are␈α⊗allowed.␈α⊗ HAL␈α∃automatically␈α⊗assumes␈α⊗CRITICAL␈α⊗before␈α⊗statements␈α∃of
␈↓enabling and disabling, and UNCRITICAL immediately following. An example:
␈↓ ON T>0 DO
␈↓ BEGIN "CONCLUSION"
␈↓ ENABLE "GOOD GUY"; COMMENT: Assumed CRITICAL;
␈↓ T ← 3; COMMENT: Assumed UNCRITICAL;
␈↓ END "CONCLUSION";
␈↓ ON S<0 DO
␈↓ BEGIN "RESULT"
␈↓ CRITICAL; COMMENT: Overrides defaults;
␈↓ T ← 4; COMMENT: Will be done immediately;
␈↓ UNCRITICAL; COMMENT: End of critical region;
␈↓ DISABLE "GOOD GUY"; COMMENT: Done eventually;
␈↓ END "RESULT"
␈↓␈↓β4.2.6 UNITS␈↓
␈↓Numbers␈α⊂are␈α⊂quite␈α⊂often␈α⊂used␈α⊂for␈α⊂measurements,␈α⊂and␈α⊂many␈α⊂different␈α⊂systems␈α⊃of␈α⊂measurement
␈↓exist.␈α∂ The␈α∂UNITS␈α∂statement␈α⊂serves␈α∂to␈α∂inform␈α∂the␈α∂compiler␈α⊂which␈α∂units␈α∂are␈α∂being␈α⊂used.␈α∂ The
␈↓compiler␈α
uses␈αits␈α
own␈αsystem␈α
for␈αinternal␈α
consistency,␈αand␈α
does␈αany␈α
scaling␈αwhen␈α
necessary.␈α The
␈↓default units, which the compiler itself uses, are placed first in the following lists:
␈↓4.2.6␈α?␈α?␈α?␈α?␈α?␈α?␈α≤CONTROL STRUCTURES␈↓
aPage 17
␈↓Time: milliseconds, seconds, jiffies (that is, thirds: 60ths
␈↓ of a second), minutes.
␈↓ (The grain of the runtime is on the order of jiffies).
␈↓Distance: centimeters, inches.
␈↓Mass: grams, ounces, pounds, kilograms.
␈↓Angles: radians, degrees.
␈↓Rotations: Euler, Bolles, Taylor, Geomed. (These are explained
␈↓ in subsection 4.3.2.)
␈↓ An example:
␈↓ UNITS SECONDS, DEGREES, TAYLOR;
␈↓␈↓β4.2.7 COMMENTS␈↓
␈↓As␈αin␈α
Algol,␈αcomments␈α
are␈αprefaced␈α
with␈αthe␈αword␈α
COMMENT␈αand␈α
terminated␈αby␈α
a␈αsemicolon.
␈↓Also, any text enclosed in curly brackets, as in
␈↓ {We are the hollow men}
␈↓will␈αbe␈α
ignored.␈α The␈α
user␈αcan␈αoptionally␈α
reset␈αthe␈α
comment␈αdelimiters␈αfrom␈α
"{}"␈αto␈α
whatever␈αshe
␈↓wishes, by means of a require statement such as:
␈↓ REQUIRE "%%" COMMENT_DELIMITERS .
␈↓which would cause the scanner to ignore any text between "%" signs.
␈↓␈↓β4.2.8 LABELS␈↓
␈↓A␈αLABEL␈αis␈αa␈α
point␈αin␈αthe␈αprogram␈αto␈α
which␈αa␈αjump␈αmay␈αbe␈α
made.␈α Labels␈αare␈αnot␈αdeclared.␈α
An
␈↓example:
␈↓ FOO: A ← A + 1;
␈↓ IF A < 100 THEN JUMP FOO;
␈↓Labels␈α
are␈α
in␈α
general␈α
useful␈α
mainly␈α
for␈αdebugging,␈α
and␈α
not␈α
for␈α
program␈α
control,␈α
especially␈αsince
␈↓JUMP will not be implemented at first.
␈↓Page 18␈α?␈α?␈α?␈α?␈α?␈α?␈α∧CONTROL STRUCTURES␈↓ ∂4.2.9
␈↓␈↓β4.2.9 ABORT␈↓
␈↓Occasionally␈α⊂the␈α⊂user␈α⊂wishes␈α⊂to␈α⊂stipulate␈α⊃that␈α⊂if␈α⊂the␈α⊂program␈α⊂ever␈α⊂reaches␈α⊂a␈α⊃particular␈α⊂point,
␈↓something␈α∂is␈α∂hopelessly␈α∂wrong.␈α∞ The␈α∂statement␈α∂ABORT␈α∂causes␈α∞the␈α∂runtime␈α∂to␈α∂stop␈α∂all␈α∞moving
␈↓devices␈αand␈α
to␈αterminate␈αexecution.␈α
The␈αsupervisor␈αis␈α
informed␈αof␈αthe␈α
halt,␈αand␈αwill␈α
inform␈αthe
␈↓user.␈α
ABORT␈αtakes␈α
an␈αoptional␈α
string␈αargument,␈α
which␈αis␈α
a␈αmessage␈α
which␈αwill␈α
be␈αgiven␈α
to␈αthe
␈↓user if the ABORT statement is executed. An example:
␈↓ ABORT ("I KEEP MISSING THE BOLT!")
␈↓␈↓β4.2.10 OUTPUT␈↓
␈↓There␈αare␈αseveral␈αways␈αthat␈αthe␈αuser␈αcan␈αrequest␈αoutput␈αfrom␈αHAL␈αto␈αthe␈αconsole.␈α As␈αmentioned
␈↓above,␈α
ABORT␈αcan␈α
print␈α
a␈αmessage␈α
during␈αexecution.␈α
There␈α
is␈αone␈α
other␈α
way␈αto␈α
print␈αa␈α
message
␈↓during␈α∪execution,␈α∪the␈α∪WRITE␈α∪statement,␈α∪which␈α∪takes␈α∪as␈α∪arguments␈α∪a␈α∪list␈α∪of␈α∪variables␈α∪and
␈↓constants.␈α It␈αis␈αalso␈αlegal␈αto␈αinclude␈αa␈α
string␈αconstant␈αin␈αthis␈αlist␈α(there␈αare␈αno␈αstring␈α
variables␈αin
␈↓HAL). Formatting of output is automatic. An example:
␈↓ WRITE ("I think that the pump is at ",PUMP)
␈↓Some␈α
pieces␈α
of␈α
code␈α
are␈α
only␈α
intended␈α
to␈α
work␈α
under␈α
certain␈α
conditions␈α
of␈α∞planning␈α
knowledge.
␈↓Such␈α
code␈αmight␈α
have␈α
a␈αcheck␈α
to␈α
insure␈αthat␈α
its␈αpreconditions␈α
are␈α
met;␈αif␈α
not,␈α
it␈αis␈α
proper␈αto␈α
signal
␈↓a␈α⊃compile-time␈α⊃error,␈α⊃with␈α⊃a␈α⊃message.␈α⊃ This␈α⊃is␈α⊃done␈α⊃with␈α⊃the␈α⊃COMPILE_ERROR␈α⊂statement,
␈↓which␈αoptionally␈αtakes␈αa␈αstring␈αargument,␈αand␈αwhich␈αwill␈αhalt␈αcompilation␈αand␈αprint␈αthe␈αmessage.
␈↓One␈α⊃of␈α⊃the␈α⊃options␈α⊃the␈α⊃supervisor␈α⊂will␈α⊃give␈α⊃the␈α⊃user␈α⊃is␈α⊃to␈α⊂proceed␈α⊃as␈α⊃if␈α⊃no␈α⊃error␈α⊃had␈α⊂been
␈↓encountered. Here is an example:
␈↓ COMPILE_ERROR("Hey! You didn't attach the pump to the hand!")
␈↓A␈α∀similar␈α∀statement␈α∀which␈α∀merely␈α∀prints␈α∃its␈α∀message␈α∀but␈α∀does␈α∀not␈α∀halt␈α∀compilation␈α∃is␈α∀the
␈↓COMPILE_WRITE␈αstatement,␈αwhich␈αbehaves␈αin␈αall␈αrespects␈αlike␈αthe␈αruntime␈αWRITE␈αstatement,
␈↓in␈αthat␈αit␈αcan␈αtake␈αvariables␈αand␈αconstants␈αin␈αits␈αargument␈αlist,␈αbut␈αwhere␈αvariables␈αare␈αspecified,
␈↓the planning values will be printed. For example:
␈↓ COMPILE_WRITE("YELLOW arm should be at",YELLOW)
␈↓4.2.11␈α?␈α?␈α?␈α?␈α?␈α?␈α∀CONTROL STRUCTURES␈↓
aPage 19
␈↓␈↓β4.2.11 PROCEDURES␈↓
␈↓HAL␈α⊃has␈α⊃only␈α⊃a␈α⊃limited␈α⊃capacity␈α⊃for␈α⊃procedures.␈α⊃ All␈α⊃parameters␈α⊃to␈α⊃a␈α⊃procedure␈α⊃assume␈α⊃the
␈↓planning␈αvalue␈α"undefined"␈αat␈αthe␈αconclusion␈αof␈αa␈αprocedure␈αcall,␈αexcept␈αthose␈αwhich␈αare␈αdeclared
␈↓as␈α∂VALUE␈α∞parameters␈α∂in␈α∞the␈α∂procedure␈α∞heading,␈α∂or␈α∞those␈α∂stated␈α∞to␈α∂be␈α∞UNCHANGED␈α∂in␈α∞the
␈↓procedure␈α⊗call.␈α∃There␈α⊗is␈α∃no␈α⊗safeguard␈α∃against␈α⊗the␈α∃accidental␈α⊗modification␈α⊗of␈α∃"unchanged"
␈↓parameters;␈αto␈αstate␈α"unchanged"␈αis␈αentirely␈αequivalent␈αto␈αan␈αassertion␈αthat␈αthe␈αparameter␈αhas␈αnot
␈↓changed its value during the execution of the procedure. The declaration of a procedure is this:
␈↓ type PROCEDURE name (argument list) ,
␈↓where␈α∞"type"␈α
is␈α∞any␈α
datatype␈α∞(and␈α
is␈α∞optional),␈α∞and␈α
"argument␈α∞list"␈α
is␈α∞a␈α
list␈α∞of␈α∞parameter␈α
names
␈↓with their types. An example:
␈↓ SCALAR PROCEDURE LGTH (FRAME F1, F2; VECTOR VALUE V1);
␈↓This␈α∂declares␈α⊂that␈α∂LGTH␈α⊂is␈α∂a␈α⊂procedure␈α∂which␈α⊂returns␈α∂a␈α⊂scalar,␈α∂and␈α⊂takes␈α∂as␈α⊂arguments␈α∂two
␈↓frames and one vector. The vector is not changed by the procedure.
␈↓To call such a procedure:
␈↓ S1 ← LGTH(FROB, UNCHANGED HOLE, VECT);
␈↓This further asserts that HOLE is not changed by the call.
␈↓Assertions␈α
are␈α
essential␈α
at␈α
the␈α
start␈α
of␈α
a␈αprocedure␈α
body␈α
to␈α
inform␈α
the␈α
compiler␈α
of␈α
the␈α
values␈αto
␈↓expect␈α⊂for␈α⊂the␈α⊂various␈α⊂arguments.␈α⊂Remember␈α⊂that␈α⊂trajectories␈α⊂planned␈α⊂on␈α⊂the␈α⊂basis␈α⊃of␈α⊂highly
␈↓inaccurate planning values will not work well. Assertions are discussed in subsection 4.7.1.
␈↓As␈α∩a␈α∩procedure␈α∪is␈α∩entered,␈α∩all␈α∪variables␈α∩have␈α∩planning␈α∪value␈α∩"undefined".␈α∩ Globals␈α∪may␈α∩be
␈↓accessed,␈α
but␈αthey␈α
also␈αhave␈α
undefined␈αinitial␈α
planning␈αvalue.␈α
All␈αvariables␈α
which␈α
have␈αexplicit
␈↓or␈α∂implicit␈α∂assignments␈α∂within␈α∂a␈α∂procedure␈α∂acquire␈α∂the␈α∂value␈α∂"undefined"␈α∂at␈α∂the␈α∂point␈α∂directly
␈↓after the procedure call.
␈↓No␈α∪modification␈α∪of␈α∩the␈α∪attach␈α∪structure␈α∩is␈α∪allowed␈α∪inside␈α∩a␈α∪procedure.␈α∪The␈α∪compiler␈α∩(often
␈↓wrongly)␈α∪assumes␈α∪that␈α∪there␈α∪are␈α∀no␈α∪attachments␈α∪involving␈α∪variables␈α∪within␈α∪a␈α∀procedure;␈α∪to
␈↓override this,
␈↓ ASSERT FACT (ATTACHED F1 F2) .
␈↓Attachments are discussed in Section 4.5.
␈↓There␈α∂are␈α∂four␈α∂special␈α∞types␈α∂of␈α∂procedure␈α∂calls:␈α∞A␈α∂HAL␈α∂program␈α∂might␈α∞wish␈α∂to␈α∂call␈α∂a␈α∞routine
␈↓coded␈αfor␈αthe␈αPDP11␈αor␈αa␈αroutine␈αcoded␈αfor␈αthe␈αPDP10.␈αLikewise,␈αa␈αprogram␈αon␈αthe␈αPDP10␈αmay
␈↓wish␈α⊂to␈α⊂control␈α⊂a␈α⊂HAL␈α⊂program,␈α⊂or␈α⊂a␈α∂routine␈α⊂on␈α⊂the␈α⊂PDP11␈α⊂may␈α⊂wish␈α⊂to␈α⊂request␈α⊂some␈α∂arm
␈↓motion.
␈↓To␈αachieve␈α
the␈αfirst␈αtwo␈α
cases,␈αthere␈α
exist␈α"external␈αprocedures"␈α
in␈αHAL.␈α
These␈αare␈αcompiled␈α
into
␈↓Page 20␈α?␈α?␈α?␈α?␈α?␈α?␈α∧CONTROL STRUCTURES␈↓ 4.2.11
␈↓calls␈α
on␈α
either␈α
routines␈α
in␈αthe␈α
PDP11␈α
or␈α
routines␈α
in␈αthe␈α
runtime␈α
PDP10␈α
package.␈α
To␈αdeclare␈α
such
␈↓a procedure:
␈↓ EXTERNAL PDP10 FRAME PROCEDURE FOO (FRAME A, B; VECTOR V) .
␈↓This␈α∂declares␈α∂the␈α∂procedure␈α⊂FOO␈α∂to␈α∂be␈α∂a␈α∂procedure␈α⊂resident␈α∂in␈α∂the␈α∂runtime␈α⊂PDP10␈α∂package,
␈↓expected␈α⊂to␈α⊂return␈α⊂a␈α⊂frame␈α⊂value,␈α⊂and␈α∂taking␈α⊂as␈α⊂arguments␈α⊂two␈α⊂frames␈α⊂and␈α⊂a␈α⊂vector.␈α∂PDP10
␈↓procedures␈α∞do␈α∞not␈α∞have␈α∞access␈α∞to␈α∞the␈α∞actual␈α∞variables␈α∞sent,␈α∞since␈α∞copies␈α∞are␈α∞made;␈α∂therefore,␈α∞all
␈↓arguments to PDP10 procedures are considered to be VALUE parameters.
␈↓It␈αis␈αpossible␈αto␈αdeclare␈αuntyped␈α(i.e.,␈αstatement-like,␈αinstead␈αof␈αexpression-like)␈αprocedures␈αas␈αwell.
␈↓Replace␈α"PDP10"␈αwith␈α"PDP11"␈αfor␈αprocedures␈αin␈αthe␈αPDP11.␈αPDP11␈αprocedures␈αdo␈αhave␈αaccess
␈↓to values, and therefore parameters are not automatically considered to be VALUE.
␈↓To␈αachieve␈αthe␈αsecond␈αtwo␈αcases,␈αthere␈αexist␈α"internal␈αprocedures"␈αin␈αHAL.␈α It␈αis␈αnot␈αnecessary␈αto
␈↓state␈αfrom␈αwhere␈αthe␈αprocedure␈α
may␈αbe␈αcalled.␈α Internal␈αprocedures␈αmust␈α
be␈αat␈αthe␈αtop␈αlevel␈α
of␈αa
␈↓HAL␈α⊂program.␈α⊂ A␈α⊂complete␈α∂HAL␈α⊂program␈α⊂is␈α⊂considered␈α∂to␈α⊂be␈α⊂an␈α⊂untyped␈α⊂procedure␈α∂without
␈↓parameters.
␈↓␈↓∧4.3 DATA STRUCTURES␈↓
␈↓␈↓β4.3.1 DECLARATIONS. PLANNING VALUES. ASSERTIONS␈↓
␈↓There␈α
are␈α
several␈αavailable␈α
types␈α
of␈α
variables␈αand␈α
constants,␈α
as␈αdescribed␈α
below␈α
in␈α
detail.␈α Each
␈↓variable␈α⊂must␈α⊂be␈α⊂declared␈α⊃somewhere␈α⊂before␈α⊂it␈α⊂is␈α⊂used;␈α⊃however,␈α⊂it␈α⊂is␈α⊂not␈α⊂necessary␈α⊃that␈α⊂this
␈↓declaration␈αbe␈αat␈α
the␈αtop␈αof␈α
a␈αblock.␈α If␈α
a␈αvariable␈αwhich␈α
has␈αnot␈αbeen␈α
declared␈αis␈αencountered,␈α
an
␈↓attempt␈αwill␈αbe␈αmade␈α
to␈αguess␈αat␈αits␈αtype.␈α
(The␈αcompiler␈αwill,␈αof␈α
course,␈αgive␈αa␈αwarning.)␈αThis␈α
can
␈↓lead␈α∞to␈α∞unfortunate␈α∂results,␈α∞so␈α∞it␈α∂is␈α∞best␈α∞to␈α∞declare␈α∂all␈α∞variables.␈α∞The␈α∂compiler␈α∞keeps␈α∞track␈α∂of␈α∞a
␈↓"planning␈α
value"␈α∞for␈α
each␈α∞variable.␈α
At␈α∞first,␈α
this␈α
value␈α∞is␈α
"undefined";␈α∞any␈α
expression␈α∞using␈α
an
␈↓undefined␈α∀value␈α∀itself␈α∀has␈α∀undefined␈α∪value.␈α∀ Planning␈α∀values␈α∀become␈α∀defined␈α∀through␈α∪two
␈↓mechanisms:␈α⊃Assertions␈α⊃and␈α⊃assignments.␈α⊃ The␈α⊃statement␈α⊃ASSERT␈α⊃X=3␈α⊃will␈α⊃set␈α∩the␈α⊃planning
␈↓value␈α∞of␈α
X␈α∞to␈α
3.␈α∞ (See␈α
subsection␈α∞4.7.1␈α∞for␈α
details␈α∞about␈α
assertions.)␈α∞The␈α
statement␈α∞X←3␈α∞has␈α
the
␈↓effect␈αof␈α
setting␈αthe␈αplanning␈α
value␈αto␈α3␈α
and␈αcausing␈αcode␈α
to␈αbe␈αgenerated␈α
for␈αthe␈αruntime␈α
to␈αset
␈↓the value of X to three at this point in the program.
␈↓The␈α∃purpose␈α∀of␈α∃having␈α∀planning␈α∃values␈α∀is␈α∃severalfold,␈α∀the␈α∃most␈α∀important␈α∃use␈α∃being␈α∀the
␈↓calculation of proper trajectories. An example is
␈↓ ASSERT YELLOW=YPARK
␈↓which␈α
tells␈αwhere␈α
the␈αyellow␈α
arm␈αis.␈α
Since␈αat␈α
planning␈α
time␈αit␈α
is␈αexpected␈α
that␈αsome␈α
values␈αwill␈α
be
␈↓known␈αonly␈αroughly,␈αprovision␈αis␈αmade␈αfor␈αthe␈αruntime␈αto␈αmodify␈αall␈αtrajectories␈αbefore␈αexecuting
␈↓4.3.1␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈ααDATA STRUCTURES␈↓
aPage 21
␈↓them.␈α
This␈α
is␈α
the␈αsubject␈α
of␈α
a␈α
later␈αdiscussion.␈α
The␈α
planning␈α
value␈αof␈α
any␈α
variable␈α
is␈αaccessible␈α
to
␈↓the programmer: #(A) is the planning value of the expression A.
␈↓Assignments␈αand␈αassertions␈αwithin␈αloops␈αpose␈αa␈αspecial␈αproblem␈αfor␈αthe␈αcompiler.␈αThe␈αquestion␈αof
␈↓when␈α
variables␈α
have␈αgood␈α
planning␈α
values␈αis␈α
a␈α
matter␈αfor␈α
research␈α
and␈αdebate;␈α
we␈α
have␈αchosen
␈↓this␈αsimple␈αrule:␈αIf␈αa␈αvariable␈αis␈αneither␈αassigned␈αnor␈αasserted␈αin␈αthe␈αloop,␈αits␈αplanning␈αvalue␈αstays
␈↓the␈αsame␈αas␈α
it␈αwas␈αwhen␈αthe␈α
loop␈αwas␈αbegun.␈α Variables␈α
which␈αhave␈αtheir␈αvalue␈α
changed,␈αeither
␈↓through␈α
assignment␈α
or␈α
by␈α
assertion,␈α
have␈α
undefined␈α
planning␈α
value␈α
between␈α
the␈α
loop␈α∞head␈α
and
␈↓the␈α∞statement␈α∞that␈α∞changes␈α∞them.␈α
JUMPS␈α∞would␈α∞so␈α∞complicate␈α∞the␈α∞planning-value␈α
computation
␈↓that they have not been implemented.
␈↓Here is an example of a loop, showing what planning values obtain at various places:
␈↓␈↓ αHA ← 1;
␈↓␈↓ αHB ← 1;
␈↓␈↓ αHC ← 1;
␈↓␈↓ αHWHILE <condition> DO
␈↓␈↓ αH BEGIN
␈↓␈↓ αH {#(A)=1, #(B)=UNDEFINED, #(C)=UNDEFINED}
␈↓␈↓ αH B ← 3;
␈↓␈↓ αH {#(A)=1, #(B)=3, #(C)=UNDEFINED}
␈↓␈↓ αH ASSERT C = #(B);
␈↓␈↓ αH B ← 4;
␈↓␈↓ αH {#(A)=1, #(B)=4, #(C)=3}
␈↓␈↓ αH END;
␈↓␈↓ αH{#(A)=1, #(B)=UNDEFINED, #(C)=UNDEFINED}
␈↓␈↓β4.3.2 ALGEBRAIC DATATYPES␈↓
␈↓The␈α
simplest␈α
datatype␈α
is␈α
the␈α
SCALAR,␈αwhich␈α
is␈α
internally␈α
represented␈α
as␈α
a␈α
fixed-point␈αnumber.
␈↓Scalars␈α⊂are␈α∂used␈α⊂as␈α∂time␈α⊂intervals,␈α⊂space␈α∂intervals,␈α⊂and␈α∂as␈α⊂substructures␈α∂upon␈α⊂which␈α⊂the␈α∂more
␈↓complicated␈α∞datatypes␈α∞are␈α∞built.␈α∞ The␈α∞UNITS␈α∂statement␈α∞allows␈α∞the␈α∞user␈α∞to␈α∞set␈α∂the␈α∞measurement
␈↓system␈αshe␈αwould␈αlike␈αto␈αuse,␈αso␈αthat␈αa␈αtime␈αscalar␈αwill␈αbe␈αunambiguously␈αinterpreted␈αas␈αmeaning
␈↓seconds, or jiffies, or whatever she wants. Some examples:
␈↓ SCALAR A, B;
␈↓ A ← 2.4;
␈↓ UNITS CENTIMETERS, SECONDS,RADIANS;
␈↓␈↓ βλ␈↓βCOMMENT:␈α∂These␈α∂units␈α∂would␈α∂only␈α∂apply␈α∂to␈α∂A,␈α∂for␈α∂example,␈α∂if␈α∂A␈α∂is␈α∂used␈α∂as␈α∞a
␈↓β␈↓ βλdistance,␈αa␈αtime,␈αor␈αan␈αangle.␈α UNITS␈αstatements␈αdo␈αnot␈αobey␈αAlgol␈αscope,␈αso␈αthis␈αone
␈↓β␈↓ βλwill be in effect until the next one appears;
␈↓ B ← 3*A;
␈↓The␈α⊃next␈α⊂datatype␈α⊃is␈α⊂the␈α⊃VECTOR.␈α⊂ A␈α⊃vector␈α⊃is␈α⊂written␈α⊃as␈α⊂a␈α⊃triple␈α⊂of␈α⊃scalars␈α⊃separated␈α⊂by
␈↓commas.␈α An␈αexample␈αis␈α(2,x,4.3).␈α Vectors␈αcan␈αrefer␈αeither␈αto␈αlocation␈αoffsets␈α(that␈αis,␈αtranslations)
␈↓Page 22␈α?␈α?␈α?␈α?␈α?␈α?␈α)DATA STRUCTURES␈↓ ∂4.3.2
␈↓or␈αto␈αorientation␈αoffsets␈α(that␈αis,␈αrotations).␈α The␈αcontext␈αis␈αsufficient␈αto␈αdetermine␈αwhich␈α
of␈αthese
␈↓meanings␈α∞is␈α∞intended.␈α∞When␈α∞a␈α∂vector␈α∞refers␈α∞to␈α∞a␈α∞translation,␈α∂it␈α∞is␈α∞understood␈α∞to␈α∞be␈α∂in␈α∞TABLE
␈↓coordinates.␈α⊂ (TABLE␈α⊂is␈α⊂defined␈α⊂below.)␈α⊂When␈α⊂a␈α⊂vector␈α⊂refers␈α⊂to␈α⊂a␈α⊂rotation,␈α⊂it␈α⊂can␈α⊃either␈α⊂be
␈↓represented␈αin␈α
Euler␈αangles␈α
(rotations␈αabout␈α
z,␈αx',␈α
z''),␈αBolles␈α
angles␈α(rotations␈α
about␈αx,␈α
y,␈αz),␈α
Taylor
␈↓angles␈α(rotations␈αabout␈αz,␈αx',␈αy'),␈αor␈αGeomed␈αangles␈α(a,␈αb,␈αc,␈αspecifying␈αthe␈αvector␈αof␈αrotation␈αwhose
␈↓magnitude␈α∂is␈α∞the␈α∂angle␈α∞of␈α∂rotation).␈α∞ Note␈α∂that␈α∞rotations␈α∂are␈α∞about␈α∂the␈α∞table␈α∂coordinate␈α∞system.
␈↓The␈α
UNITS␈α
statement␈α∞serves␈α
to␈α
set␈α
a␈α∞default␈α
mode␈α
(as␈α
well␈α∞as␈α
to␈α
determine␈α
whether␈α∞degrees␈α
or
␈↓radians␈α
are␈αbeing␈α
used).␈α There␈α
are␈αthree␈α
predefined␈α
vector␈αconstants:␈α
X,␈αY,␈α
and␈αZ.␈α
These␈αare␈α
the
␈↓unit vectors in TABLE coordinates.
␈↓Examples:
␈↓ VECTOR V1, V2;
␈↓ V1 ← (3,1,A);
␈↓ V2 ← V1 ∂ (π,0,0);
␈↓A␈α
FRAME␈α∞is␈α
a␈α∞location␈α
with␈α∞an␈α
orientation.␈α∞ It␈α
has␈α∞two␈α
basic␈α∞interpretations,␈α
which␈α∞are␈α
closely
␈↓related:␈α⊃1)␈α⊂a␈α⊃hand␈α⊂position,␈α⊃and␈α⊂2)␈α⊃the␈α⊂location␈α⊃and␈α⊂orientation␈α⊃of␈α⊂any␈α⊃object.␈α⊂ TABLE␈α⊃is␈α⊂a
␈↓predefined␈αframe.␈α(It␈αholds␈αtable␈αcoordinates.)␈αEach␈αarm␈α(currently,␈αYELLOW␈αand␈αBLUE)␈αis␈αalso
␈↓a␈αpredefined␈αframe;␈αthese␈αframes␈αare␈α"read␈αonly"␈αin␈αthe␈αsense␈αthat␈αthey␈αmay␈αnot␈αappear␈αto␈αthe␈αleft
␈↓of␈α∞an␈α∞assignment␈α∞arrow.␈α∂ The␈α∞values␈α∞of␈α∞YELLOW␈α∞and␈α∂BLUE␈α∞are␈α∞implicitly␈α∞modified␈α∂by␈α∞arm
␈↓motions,␈αhowever.␈αThe␈αrest␈αpositions␈αof␈αthe␈αtwo␈αarms␈αare␈αYPARK␈αand␈αBPARK,␈αwhich␈αare␈α
frame
␈↓constants.
␈↓Frames␈αare␈αdescribed␈αby␈αa␈αpair␈αof␈αvectors:␈αone␈αfor␈αposition␈αand␈αone␈αfor␈αorientation.␈α An␈αexample
␈↓of a frame expression is
␈↓ [LOC : ORIENT]
␈↓where␈α∞LOC␈α∂is␈α∞a␈α∂vector␈α∞specifying␈α∞location,␈α∂and␈α∞ORIENT␈α∂is␈α∞a␈α∞vector␈α∂for␈α∞the␈α∂orientation␈α∞(with
␈↓respect to the table). Examples:
␈↓ FRAME F1, F2;
␈↓ F1 ← [V1 : V2];
␈↓ F2 ← F1 ∂ V2;
␈↓A␈α∂PLANE␈α∂is␈α⊂constructed␈α∂from␈α∂two␈α∂vectors:␈α⊂the␈α∂plane␈α∂passes␈α∂through␈α⊂the␈α∂first␈α∂vector,␈α⊂and␈α∂the
␈↓outward-facing normal is in the direction of the second vector. The syntax is
␈↓ VECTOR1 \ VECTOR2.
␈↓Thus, the surface of the table is (0,0,0) \ Z.
␈↓Planes␈α⊃divide␈α⊃the␈α⊃universe␈α⊃into␈α⊃three␈α⊃sets␈α⊃with␈α⊃respect␈α⊃to␈α⊃the␈α⊃plane:␈α⊃inside,␈α⊃on,␈α∩and␈α⊃outside.
␈↓Outside␈αare␈αall␈αpoints␈αwhich␈αare␈αon␈αthe␈α
side␈αof␈αthe␈αplane␈αtowards␈αthe␈αoutward-facing␈αnormal.␈α
To
␈↓determine␈α
where␈αa␈α
point␈α
lies␈αwith␈α
respect␈α
to␈αa␈α
plane,␈αthat␈α
is,␈α
whether␈αit␈α
is␈α
inside,␈αon,␈α
or␈αoutside␈α
the
␈↓plane, use the expression
␈↓ VECTOR ␈↓∧.␈↓ PLANE .
␈↓4.3.2␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈ααDATA STRUCTURES␈↓
aPage 23
␈↓Its␈α
value␈αis␈α
a␈αscalar␈α
whose␈αabsolute␈α
value␈αis␈α
the␈α
shortest␈αdistance␈α
from␈αthe␈α
vector␈αto␈α
the␈αplane,␈α
and
␈↓whose␈α
sign␈α
is␈α
negative␈α
if␈α
the␈α
vector␈α
is␈α
inside␈αthe␈α
plane,␈α
0␈α
if␈α
the␈α
vector␈α
is␈α
on␈α
the␈α
plane,␈αand␈α
positive
␈↓if the vector is outside the plane.
␈↓It␈α∂is␈α∂occasionally␈α∂useful␈α∂to␈α∂construct␈α∂a␈α∂plane␈α∂from␈α∂four␈α∂scalars:␈α∂the␈α∂first␈α∂three␈α∂are␈α∂the␈α∞outward
␈↓pointing␈α
normal␈α
vector␈α(which␈α
will␈α
be␈αnormalized␈α
if␈α
necessary);␈αthe␈α
fourth␈α
is␈αthe␈α
opposite␈α
of␈αthe
␈↓distance to the origin (of table coordinates). The way to express such a plane is like this:
␈↓ (S1,S2,S3,S4) .
␈↓Examples:
␈↓ PLANE P1, P2;
␈↓ P1 ← LOC(F1) \ (X WRT F1); COMMENT: Y-Z plane of F1;
␈↓ P2 ← P1 + (P1.(0,0,0))*NORMAL(P1); COMMENT: Moves P1 to origin;
␈↓ S1 ← V1 . P1;
␈↓ P1 ← (2,4,3.2,8.1); COMMENT: Fairly meaningless;
␈↓A␈αTRANS␈αis␈αan␈αoperator␈α
acting␈αon␈αvectors,␈αframes,␈αplanes,␈αand␈α
other␈αtranses.␈α It␈αis␈αdefined␈αas␈α
the
␈↓relation␈α⊂between␈α∂two␈α⊂frames.␈α⊂ An␈α∂example␈α⊂is␈α⊂FRAME1␈α∂→␈α⊂FRAME2.␈α⊂ The␈α∂value␈α⊂of␈α⊂this␈α∂trans
␈↓applied␈α
to␈α
FRAME1␈α
is␈α
FRAME2.␈α
That␈α
is,␈α
(FRAME1→FRAME2)*FRAME1␈α
is␈α
identically␈α
equal␈α
to
␈↓FRAME2. A trans can be built up from a rotation and a translation; the expression is
␈↓ [TRANSLATION | ROTATION] .
␈↓Note␈α⊗that␈α↔rotation␈α⊗is␈α↔applied␈α⊗first.␈α⊗ Some␈α↔people␈α⊗find␈α↔it␈α⊗helpful␈α⊗to␈α↔think␈α⊗of␈α↔frames␈α⊗as
␈↓transformations: The transformation associated with a frame A is
␈↓ TABLE → A .
␈↓When␈α⊃a␈α⊂frame␈α⊃is␈α⊃used␈α⊂in␈α⊃a␈α⊃context␈α⊂demanding␈α⊃a␈α⊂transformation,␈α⊃it␈α⊃will␈α⊂be␈α⊃understood␈α⊃as␈α⊂a
␈↓shorthand for the trans leading from the table. Transes operate on the left. Examples:
␈↓ TRANS T1, T2;
␈↓ T1 ← F1→F2;
␈↓ V1 ← T1*V2;
␈↓ T2 ← T1*T1;
␈↓␈↓β4.3.3 ARITHMETIC␈↓
␈↓Here␈α
is␈α
a␈αsummary␈α
of␈α
the␈αarithmetic␈α
expressions␈α
available.␈α They␈α
are␈α
grouped␈αby␈α
the␈α
type␈αof␈α
their
␈↓values. These abbreviations are used: `s' = scalar , `v' = vector , `f' = frame, `p' = plane, `t' = trans. ␈↓ε
␈↓Page 24␈α?␈α?␈α?␈α?␈α?␈α?␈α)DATA STRUCTURES␈↓ ∂4.3.3
␈↓εscalar expressions:
␈↓εs + s scalar addition (commutative)
␈↓εs - s scalar subtraction
␈↓εs * s scalar multiplication (commutative)
␈↓εs / s scalar division
␈↓εv . v dot product of two vectors (commutative)
␈↓ε| v | magnitude of vector
␈↓εp . v signed distance from vector to plane (see discussion
␈↓ε above on planes)
␈↓εvector expressions:
␈↓ε(s,s,s) forming a vector from three scalars
␈↓εs * v dilation of a vector
␈↓εv + v vector addition (translation of the first vector by
␈↓ε the second) (commutative)
␈↓εv ∂ v rotation of the first vector by the second
␈↓εt * v transformation of a vector
␈↓εf / f difference (rotation) between two frames
␈↓εv WRT f a vector of length |v| rotated into f's system; like
␈↓ε v ∂ orient(f); that is, a vector in table
␈↓ε coordinates which looks to the table as v
␈↓ε does to f.
␈↓εframe expressions:
␈↓ε[v : v] forming a frame from location (first vector) and
␈↓ε an orientation (second vector)
␈↓εf + v translating a frame; modifies only the location part
␈↓εf ∂ v rotating a frame; modifies only the orientation part
␈↓εt * f transformation of a frame
␈↓εplane expressions:
␈↓εv \ v formation of a plane. Goes through first vector,
␈↓ε outward pointing normal is in direction of
␈↓ε the second vector.
␈↓ε(s,s,s,s) formation of a plane. First 3 scalars form outward-
␈↓ε pointing normal; last scalar is opposite of
␈↓ε distance to (table) origin.
␈↓εp + v translation of a plane by a vector
␈↓εp ∂ v rotation of plane (about table origin) by a vector
␈↓εt * p transformation of a plane by a trans
␈↓εtrans expressions:
␈↓εf → f transformation which leads from the first frame to
␈↓ε the second
␈↓ε[v | v] composing a translation, then a rotation to make a
␈↓ε trans. Even though the translation is
␈↓ε written first, it is applied after the
␈↓ε rotation.
␈↓εt + v translating a trans; modifies only the translation
␈↓ε part.
␈↓εt ∂ v rotating a trans; modifies only the rotation part.
␈↓εt * t composing two transes. Transes operate on the left.
␈↓4.3.3␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈ααDATA STRUCTURES␈↓
aPage 25
␈↓εPREDEFINED CONSTANTS AND VARIABLES:
␈↓επ is 3.14159...
␈↓εTABLE is a frame which has standard table coordinates. (constant)
␈↓εBLUE is the location of the blue hand.
␈↓εYELLOW is the location of the yellow hand.
␈↓εBPARK is where the blue hand parks. (constant)
␈↓εYPARK is where the yellow hand parks. (constant)
␈↓εX is (1,0,0).
␈↓εY is (0,1,0).
␈↓εZ is (0,0,1).
␈↓Any␈αexpression␈αpreceeded␈αwith␈αthe␈αsymbol␈α"#"␈α
means␈α"the␈αplanning␈αvalue␈αof␈αthis␈αexpression",␈α
that
␈↓is, a constant is substituted for the entire expression in the expander.
␈↓EXTRACTION FUNCTIONS:
␈↓LOC(FRAME) is a vector whose value is the location of the frame.
␈↓ORIENT(FRAME) is a vector whose value is the orientation of the frame.
␈↓XSCAL(VECTOR) is the X coordinate of the vector.
␈↓YSCAL(VECTOR) is the Y coordinate of the vector.
␈↓ZSCAL(VECTOR) is the Z coordinate of the vector.
␈↓NORMAL(PLANE) is the outward facing normal vector of a plane.
␈↓␈↓β4.3.4 SOME EXAMPLES OF ARITHMETIC EXPRESSIONS␈↓
␈↓In the following examples, assume these declarations:
␈↓FRAME F1, F2, etc;
␈↓VECTOR V1, V2, etc;
␈↓SCALAR S1, S2, etc;
␈↓PLANE P1, P2, etc;
␈↓F1'S unit Y vector, in TABLE coordinates:
␈↓ F1*(0,1,0)
␈↓ F1 * Y
␈↓F1's Z vector as seen from F2:
␈↓ (F2→F1) * (0,0,1)
␈↓ (F2→F1) * Z
␈↓A vector pointing in same direction as F1's X coordinate:
␈↓ X WRT F1
␈↓Page 26␈α?␈α?␈α?␈α?␈α?␈α?␈α)DATA STRUCTURES␈↓ ∂4.3.4
␈↓V1 rotated 90 degrees about the table's Z axis:
␈↓ UNITS EULER;
␈↓ V1 ∂ (90,0,0)
␈↓F1's Y-Z plane:
␈↓ LOC(F1) \ (X WRT F1)
␈↓A plane 3 units above the table:
␈↓ (0,0,3) \ Z
␈↓ (3*Z) \ Z
␈↓␈↓∧4.4 MOTIONS␈↓
␈↓␈↓β4.4.1 COMPILE-TIME AND RUNTIME CONSIDERATIONS␈↓
␈↓All␈α∞motion␈α∞statements␈α
cause␈α∞the␈α∞compiler␈α∞to␈α
make␈α∞some␈α∞plans␈α∞for␈α
the␈α∞eventual␈α∞execution␈α∞of␈α
the
␈↓motion.␈α∩ These␈α∪plans␈α∩are␈α∩more␈α∪or␈α∩less␈α∩complicated,␈α∪depending␈α∩on␈α∩the␈α∪exact␈α∩type␈α∪of␈α∩motion
␈↓requested.␈α Those␈αmotions␈αwhich␈αdepend␈αon␈αthe␈αvalue␈αof␈αsome␈αframes␈αas␈αparameters␈αto␈αthe␈αaction
␈↓will be planned using the compile-time planning values for all relevant frames.
␈↓Immediately␈α
before␈α
the␈α
arm␈α
starts␈α
moving␈α
on␈α
a␈α
trajectory,␈α
the␈α
plan␈α
is␈α
modified␈α
to␈α
bring␈α
it␈αinto␈α
line
␈↓with␈α
current␈αvalues␈α
of␈αframes.␈α
The␈αresult␈α
of␈αthis␈α
last-minute␈αmodification␈α
is␈αthat␈α
if␈αthere␈α
is␈αany
␈↓discrepancy␈α
between␈α
the␈α
runtime␈α
and␈α
compile-time␈αunderstanding␈α
of␈α
where␈α
any␈α
frame␈α
is,␈αthe␈α
servo
␈↓will␈α⊂place␈α⊂the␈α⊂arm␈α⊂in␈α⊂the␈α⊂right␈α⊂place␈α∂nonetheless.␈α⊂ There␈α⊂are␈α⊂limits␈α⊂to␈α⊂the␈α⊂proper␈α⊂use␈α⊂of␈α∂this
␈↓feature;␈α
if␈αthe␈α
planning␈α
value␈αis␈α
seriously␈α
in␈αerror␈α
(and␈α
this␈αcan␈α
mean␈α
anywhere␈αfrom␈α
a␈αfew␈α
inches
␈↓to␈αa␈αfoot,␈αdepending␈αon␈αthe␈αarm␈αbeing␈αused␈αand␈αits␈αconfiguration),␈αthen␈αthe␈αattempt␈αto␈αmake␈αlast-
␈↓minute␈α⊃corrections␈α⊃will␈α⊃either␈α⊃overstrain␈α⊃the␈α⊂arm␈α⊃or␈α⊃impair␈α⊃force␈α⊃and␈α⊃free␈α⊃sensing␈α⊂(discussed
␈↓below).
␈↓It␈α
is␈α
the␈α
user's␈α
responsibility␈αto␈α
foresee␈α
such␈α
discrepancies␈α
in␈αthe␈α
planning␈α
value␈α
and␈α
to␈αbranch␈α
her
␈↓program␈αso␈α
that␈αseveral␈α
moves␈αare␈α
planned␈α(with␈αASSERT␈α
statements␈αto␈α
inform␈αthe␈α
compiler␈αof
␈↓the␈α⊂assumptions␈α∂being␈α⊂used).␈α∂The␈α⊂IF-THEN-ELSE␈α∂statement␈α⊂will␈α∂be␈α⊂useful␈α∂in␈α⊂performing␈α∂the
␈↓correct␈αbranch␈αat␈α
runtime.␈α Its␈αcondition␈α
will␈αmost␈αlikely␈α
involve␈αthe␈αlocation␈α
of␈αa␈αframe.␈α
Actually,
␈↓the␈α∀compiler␈α∀will␈α∀eventually␈α∀be␈α∀able␈α∀to␈α∃do␈α∀some␈α∀of␈α∀this␈α∀artificial␈α∀splitting␈α∀by␈α∃using␈α∀locus
␈↓information and given tolerances.
␈↓The␈αlast␈αstep␈αof␈αany␈αmotion␈αis␈αthe␈αreevaluation␈αof␈αthe␈αlocation␈αof␈αthe␈αhand,␈αand␈αthe␈αupdating,␈αif
␈↓necessary, of the values of all frames attached to it.
␈↓4.4.2␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∩MOTIONS␈↓
aPage 27
␈↓␈↓β4.4.2 SIMPLE MOVES␈↓
␈↓A␈α
move␈αis␈α
simple␈αif␈α
it␈α
involves␈αonly␈α
one␈αarm.␈α
A␈α
smooth␈αtrajectory␈α
is␈αcompiled␈α
by␈αsplining␈α
together
␈↓polynomial␈α⊃segments␈α⊃(usually␈α⊃third␈α⊃degree,␈α∩occasionally␈α⊃fourth)␈α⊃separately␈α⊃for␈α⊃each␈α∩arm␈α⊃joint.
␈↓This␈α
trajectory␈α∞calculation␈α
is␈α
somewhat␈α∞time-consuming,␈α
and␈α
is␈α∞done␈α
completely␈α
at␈α∞compile␈α
time.
␈↓The␈αarm␈αis␈αexpected␈αto␈αtravel␈αfrom␈αits␈αcurrent␈αposition␈αto␈αthe␈αfinal␈αposition,␈αpassing␈αthrough␈αany
␈↓specified␈αintermediate␈αpositions.␈α The␈αstandard␈αway␈αto␈αavoid␈αthe␈αtable␈αis␈αto␈αbegin␈αmotion␈αdirectly
␈↓away␈αfrom␈αit␈αand␈αto␈αend␈αmotion␈αdirectly␈αtoward␈αit.␈α There␈αis␈αa␈αdefault␈αoffset␈αassociated␈αwith␈αeach
␈↓frame,␈α
called␈αits␈α
"deproach",␈αwhich␈α
is␈αused␈α
to␈αcalculate␈α
the␈αfirst␈α
and␈αthe␈α
last␈αof␈α
the␈αintermediate,␈α
or
␈↓"via"␈α
points.␈α The␈α
deproach␈α
of␈αa␈α
frame␈α
is␈αstored␈α
in␈α
the␈αassertional␈α
data␈α
base,␈αwhich␈α
is␈αdiscussed␈α
in
␈↓subsection 4.7.1. An example:
␈↓ MOVE YELLOW {Smooth motion, for yellow arm}
␈↓ TO FROBGRASP {Name of (frame) destination}
␈↓ VIA SWING1, SWING2 {Two via-points}
␈↓This␈α
example␈α
demonstrates␈α
the␈αgeneral␈α
syntax;␈α
the␈α
reserved␈α
word␈αMOVE␈α
is␈α
followed␈α
by␈αthe␈α
name
␈↓of␈α
the␈αframe␈α
to␈αbe␈α
moved␈α(usually␈α
an␈αarm)␈α
and␈αa␈α
set␈αof␈α
clauses,␈αeach␈α
beginning␈αwith␈α
a␈αreserved
␈↓word (here the words TO and VIA). There is no punctuation necessary at the end of a clause.
␈↓In␈αthe␈αexample␈αabove,␈αThe␈αfirst␈αimplicit␈αvia␈αpoint␈αwill␈αbe␈αthe␈αdeproach␈αpoint␈αfor␈αwhatever␈αframe
␈↓at␈αwhich␈αthe␈αyellow␈αarm␈αis␈αcurrently␈αpositioned.␈α The␈αlast␈αimplicit␈αvia␈αpoint␈αwill␈αbe␈αthe␈αdeproach
␈↓point for frobgrasp.
␈↓At␈α
each␈α
of␈α
the␈α
via-points,␈α
several␈α
conditions␈αmay␈α
be␈α
specified.␈α
These␈α
are␈α
velocity␈α
and␈α
upper␈αor
␈↓lower␈α
bounds␈α
on␈α
the␈αtime␈α
required␈α
to␈α
reach␈αthis␈α
frame␈α
from␈α
the␈α
previous␈αone␈α
on␈α
the␈α
list.␈αAlso,␈α
one
␈↓may␈αspecify␈α
that␈αa␈α
piece␈αof␈α
code␈αis␈α
to␈αbe␈αinitiated␈α
when␈αa␈α
VIA␈αpoint␈α
is␈αachieved;␈α
this␈αis␈αdone␈α
with
␈↓a␈α
THEN␈α
construct.␈α
The␈α
statement␈α
following␈α
THEN␈α
may␈α
not␈α
be␈α
a␈α
jump␈α
or␈α
a␈α
motion␈αstatement␈α
for
␈↓the␈α∞same␈α∂arm.␈α∞ (If␈α∂the␈α∞statement␈α∂is␈α∞a␈α∞motion␈α∂statement,␈α∞it␈α∂must␈α∞be␈α∂surrounded␈α∞by␈α∂BEGIN␈α∞and
␈↓END.) An example:
␈↓ VIA F1 (VEL=3*Z), F2 THEN ENABLE "CH1", F3 (VEL=0, DURATION=5) .
␈↓This␈α⊂specifies␈α⊂three␈α⊂via␈α⊂points.␈α⊂ At␈α∂the␈α⊂first,␈α⊂the␈α⊂velocity␈α⊂is␈α⊂to␈α∂be␈α⊂3*Z,␈α⊂at␈α⊂the␈α⊂second␈α⊂a␈α∂scalar
␈↓variable␈α
is␈α
to␈αbe␈α
set,␈α
and␈αat␈α
the␈α
third␈αthe␈α
velocity␈α
is␈αto␈α
be␈α
0␈αand␈α
it␈α
should␈αtake␈α
5␈α
seconds␈α
to␈αget
␈↓there from F2.
␈↓Certain␈αthings␈αmust␈αbe␈αspecified␈αfor␈αany␈αmove.␈α First␈αis␈αthe␈αarm␈αwhich␈αis␈αto␈αbe␈αmoved.␈α It␈αcan␈αbe
␈↓named␈α
directly␈α
(as␈αYELLOW␈α
or␈α
BLUE)␈α
or␈αby␈α
naming␈α
a␈αframe␈α
which␈α
is␈α
to␈αbe␈α
moved:␈α
If␈αFROB␈α
is
␈↓attached␈α∞to␈α∞a␈α∞hand,␈α
it␈α∞is␈α∞perfectly␈α∞reasonable␈α
to␈α∞request␈α∞that␈α∞the␈α
frob␈α∞be␈α∞moved␈α∞to␈α∞a␈α
particular
␈↓location.␈α∃ So␈α∃if␈α∀FROB␈α∃is␈α∃a␈α∃frame␈α∀attached␈α∃to␈α∃BLUE,␈α∃then␈α∀both␈α∃FROB␈α∃and␈α∃BLUE␈α∀are
␈↓"controllable␈α
frames";␈α
MOVE␈α
FROB␈α
is␈α
perfectly␈α
legal.␈α
A␈α
discussion␈α
of␈α
frame␈α
attachment␈α
can␈αbe
␈↓found in Section 4.5.
␈↓Next,␈α
the␈α
destination␈α
frame␈α
must␈α
be␈α
specified.␈α
TO␈α
F1␈α
means␈α
that␈α
at␈α
the␈α
end␈α
of␈α
the␈α
motion,␈α
the
␈↓controllable␈αframe␈α(assume␈αit␈αis␈αan␈αarm)␈αshould␈αcoincide␈αwith␈αthe␈αframe␈αF1.␈α MOVE␈αFROB␈αTO
␈↓F2␈α∂means␈α∂that␈α⊂at␈α∂the␈α∂end␈α∂of␈α⊂the␈α∂motion,␈α∂FROB␈α∂coincides␈α⊂with␈α∂F2.␈α∂ A␈α⊂notational␈α∂convenience
␈↓about␈αdestinations:␈αThey␈αcan␈αbe␈αspecified␈αin␈αterms␈αof␈αwhere␈αthe␈αcontrollable␈αframe␈αis␈αat␈α
the␈αstart
␈↓Page 28␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α9MOTIONS␈↓ ∂4.4.2
␈↓of␈α⊃the␈α⊃motion.␈α⊃ The␈α⊃symbol␈α⊃for␈α⊃this␈α⊃is␈α⊃⊗.␈α∩ That␈α⊃is,␈α⊃⊗␈α⊃is␈α⊃a␈α⊃frame␈α⊃which␈α⊃is␈α⊃the␈α∩location␈α⊃and
␈↓orientation␈αof␈αthe␈α
controllable␈αframe␈αat␈α
the␈αstart␈αof␈α
the␈αmotion.␈α Thus,␈α
⊗␈α+␈α(0,0,1)␈α
is␈αa␈αframe␈α1␈α
unit
␈↓above the starting place (in table coordinates).
␈↓␈↓β4.4.3 OPTIONS FOR MOVES␈↓
␈↓DIRECTLY␈α∂tells␈α∂the␈α∂compiler␈α∂that␈α∂only␈α∂the␈α∂via␈α∂points␈α∂and␈α∂the␈α∂final␈α∂point␈α∂are␈α∂of␈α⊂interest;␈α∂no
␈↓smooth␈α
trajectory␈α
need␈α
be␈α
planned.␈α
A␈α
smooth␈α
motion␈α
will␈α
result␈α
due␈α
to␈α
runtime␈α
calculations.␈α
This
␈↓will also set the deproaches to NIL. (Deproaches are discussed in subsection 4.4.4.)
␈↓ON␈α∩requests␈α∩that␈α⊃certain␈α∩conditions␈α∩be␈α⊃continually␈α∩monitored␈α∩during␈α⊃motion.␈α∩ These␈α∩can␈α⊃be
␈↓conditions␈α∀of␈α∪any␈α∀sort,␈α∀including␈α∪flag␈α∀checking,␈α∪force␈α∀checking,␈α∀and␈α∪time␈α∀checking.␈α∀ If␈α∪any
␈↓monitored␈α
condition␈α
triggers,␈α
the␈α
DO␈α
part␈α
associated␈α
with␈α
it␈α
will␈α
be␈α
executed.␈α
The␈α
"block"␈α
of␈α
a
␈↓motion-based ON monitor is the motion statement itself; exiting the motion will disable the test.
␈↓Several␈αfunctions␈α
can␈αbe␈αtested␈α
continually;␈αthese␈α
include␈αforce␈αalong␈α
a␈αvector␈α
(FORCE(V)),␈αtime
␈↓since beginning of motion (DURATION), and the force between the fingers (SQUEEZE).
␈↓One␈αmore␈α"function"␈αis␈αtestable:␈αARRIVAL.␈α This␈αbecomes␈αtrue␈αwhen␈αthe␈αmotion␈αterminates␈αdue
␈↓to␈α
either␈α
having␈α
reached␈α
its␈α
destination.␈α
It␈α
does␈α
not␈α
become␈α
true␈α
if␈α
the␈α
arm␈α
stops␈α
for␈α
reasons␈α
other
␈↓than normal arrival at the destination; STOP does not trigger it. An example:
␈↓ ON FORCE(Z)>10 DO
␈↓ BEGIN WRITE("OUCH"); STOP END
␈↓TRACING␈α
is␈αanother␈α
option.␈α It␈α
allows␈α
the␈αuser␈α
greater␈αcontrol␈α
over␈αthe␈α
exact␈α
trajectory␈αchosen
␈↓for␈α
the␈α
move.␈α
The␈α
path␈αcan␈α
be␈α
traced␈α
at␈α
whatever␈αspeed␈α
desired.␈α
The␈α
path,␈α
or␈α"parameterized
␈↓frame",␈αis␈αa␈α
specification␈αof␈αwhat␈αframe␈α
the␈αarm␈αis␈α
to␈αgo␈αthrough␈αfor␈α
each␈αvalue␈αof␈αthe␈α
parameter.
␈↓Of␈αcourse,␈αone␈αalso␈αspecifies␈αthe␈αrelation␈αbetween␈αthe␈αparameter␈αand␈αreal␈αtime.␈α It␈αis␈αalso␈αpossible
␈↓to␈αstate␈αthe␈αgrain␈αof␈αthe␈αmotion␈αand␈αthe␈αtolerance␈αthat␈αis␈αacceptable␈α(as␈αa␈αdistance␈αin␈α3-space).␈αAn
␈↓example:
␈↓ MOVE YELLOW
␈↓ TRACING CENTER + (COS(P),SIN(P),0)
␈↓ FOR P ← 0 UNTIL 2*π
␈↓ WITHIN .1;
␈↓should move the yellow arm in a circle around CENTER.
␈↓The␈αoption␈αMAINTAINING␈αORIENTATION␈αcauses␈αthe␈αtrajectory␈αcomputed␈αby␈αHAL␈αto␈αtry␈αto
␈↓maintain␈αthe␈αsame␈αhand␈αorientation␈αthroughout␈α
the␈αmotion.␈α Of␈αcourse,␈αthe␈αfinal␈αorientation␈α
must
␈↓be the same as the initial orientation for this to work at all.
␈↓USING␈α⊂lists␈α⊂a␈α⊂set␈α⊂of␈α⊂modes␈α⊂under␈α⊂which␈α⊂the␈α⊂motion␈α⊂is␈α⊂to␈α⊂be␈α⊂performed.␈α⊂ These␈α⊂can␈α⊂include
␈↓duration␈α∞control,␈α
force␈α∞applied␈α∞in␈α
some␈α∞direction,␈α
which␈α∞directions␈α∞should␈α
be␈α∞free␈α∞from␈α
position
␈↓4.4.3␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∩MOTIONS␈↓
aPage 29
␈↓feedback,␈α∩and␈α∩what␈α⊃the␈α∩departure␈α∩and␈α∩approach␈α⊃should␈α∩be␈α∩(if␈α∩it␈α⊃is␈α∩desired␈α∩to␈α∩override␈α⊃the
␈↓defaults, which are properties of the frames involved at the beginning and end of motion).
␈↓Duration␈α
refers␈α
to␈αthe␈α
time␈α
elapsed␈αsince␈α
the␈α
start␈αof␈α
motion.␈α
In␈αan␈α
ON-monitor,␈α
one␈α
can␈αcheck
␈↓for␈αduration␈αbecoming␈αtoo␈αlong.␈α In␈αthe␈αUSING␈αconstruct,␈αduration␈αis␈αmerely␈αa␈αnote␈αfor␈αhow␈αlong
␈↓the␈αtrajectory␈αshould␈αbe␈αplanned␈αto␈αtake.␈α One␈αcan␈αuse␈α␈↓ε≥␈↓,=,or␈α≤␈αfor␈αthis,␈αalthough␈α≤␈αis␈αmost␈αlikely
␈↓risky. Example:
␈↓ USING DURATION ␈↓ε≥␈↓ 3 .
␈↓Force␈αspecifies␈αboth␈αa␈αdirection␈αand␈αan␈αintensity.␈α During␈αthe␈αmotion,␈αan␈αattempt␈αwill␈αbe␈αmade␈αto
␈↓apply␈α∞the␈α∞required␈α∞force.␈α∞ This␈α∞is␈α∞done␈α
by␈α∞applying␈α∞certain␈α∞forces␈α∞in␈α∞some␈α∞combination␈α∞of␈α
arm
␈↓joints.␈α Which␈αarm␈αjoints␈αare␈αaffected␈αis␈αdecided␈αby␈αthe␈αcompiler;␈αif␈αthe␈αmotion␈αis␈αlong,␈αit␈αis␈αlikely
␈↓that␈α∞the␈α∞particular␈α∞joints␈α∞applying␈α∞force␈α∞will␈α∂be␈α∞scheduled␈α∞to␈α∞change␈α∞during␈α∞the␈α∞motion,␈α∂as␈α∞the
␈↓aspect of the arm changes. To get a force in the hand's Z direction, say, one would write
␈↓ FORCE = Z WRT @ ,
␈↓where␈α∞@␈α∂is␈α∞a␈α∞symbol␈α∂meaning␈α∞"the␈α∞location␈α∂of␈α∞the␈α∞controllable␈α∂frame,␈α∞as␈α∂continuously␈α∞changing
␈↓during motion."
␈↓A␈α
free␈α
direction␈α
is␈α
one␈α
in␈α
which␈α
all␈α
position␈α
errors␈α
are␈α
ignored␈α
by␈α
the␈α
servo.␈α
As␈α
for␈α∞forces,␈α
the
␈↓compiler␈αtranslates␈αthis␈αinto␈αa␈αset␈αof␈αjoints␈αwhich␈αare␈αto␈αhave␈αthe␈αposition␈αfeedback␈αdisabled,␈αand
␈↓this␈α∩set␈α∩may␈α∩vary␈α∩throughout␈α∩the␈α∩motion.␈α∩ Once␈α∪again,␈α∩the␈α∩@␈α∩may␈α∩be␈α∩used␈α∩to␈α∩refer␈α∪to␈α∩the
␈↓controllable frame as it moves.
␈↓It␈αis␈αpossible␈αto␈α
free␈αmore␈αthan␈αone␈α
direction,␈αor␈αapply␈αforce␈αin␈α
more␈αthan␈αone␈αdirection.␈α
In␈αthis
␈↓case,␈α
the␈α
directions␈αspecified␈α
for␈α
force␈α
must␈αbe␈α
orthogonal,␈α
as␈α
must␈αthe␈α
directions␈α
specified␈αfor␈α
free.
␈↓This␈α⊂restriction␈α⊂is␈α⊃enforced␈α⊂by␈α⊂the␈α⊂requirement␈α⊃that␈α⊂multiple␈α⊂forces␈α⊂and␈α⊃frees␈α⊂all␈α⊂be␈α⊃set␈α⊂with
␈↓respect to the cardinal directions of one frame. Examples:
␈↓ USING FORCE = Z WRT FROB, FORCE=X WRT FROB, FREE=Y WRT HAND
␈↓ USING FORCE = (2,1,0), APPROACH = APPROACH(FROB);
␈↓ COMMENT: This form will be explained in subsection 4.4.4;
␈↓ USING FREE = X, FREE = Y, DEPARTURE = NIL
␈↓Since␈α∞both␈α
force␈α∞and␈α
free␈α∞are␈α
translated␈α∞by␈α
the␈α∞compiler␈α
into␈α∞special␈α
handling␈α∞of␈α∞certain␈α
joints,
␈↓surprises␈αcan␈αresult␈αfrom␈αlarge␈αdiscrepancies␈αbetween␈αthe␈αplanning␈αvalues␈αand␈αthe␈αactual␈αruntime
␈↓values.␈α
The␈α
motions␈α
will␈α
go␈α
through␈α
the␈α
right␈α
places,␈α
but␈α
the␈α
directions␈α
of␈α
force␈α
and␈αfreedom␈α
may
␈↓be wildly wrong.
␈↓The␈αnotions␈αof␈αforce␈αand␈αfree␈αare␈αhardware-dependent;␈αthey␈αdepend␈αon␈αthe␈αparticular␈αarm␈αin␈αuse.
␈↓Hopefully,␈α∩as␈α⊃more␈α∩sophisticated␈α⊃arms␈α∩become␈α⊃available,␈α∩USING␈α⊃can␈α∩be␈α⊃extended␈α∩to␈α⊃handle
␈↓whatever new capabilities exist.
␈↓Page 30␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α9MOTIONS␈↓ ∂4.4.4
␈↓␈↓β4.4.4 DEPROACHES␈↓
␈↓Many␈α∞objects␈α∞have␈α∞shapes␈α∞which␈α∞necessitate␈α∂care␈α∞as␈α∞the␈α∞arm␈α∞approaches␈α∞them␈α∞or␈α∂departs␈α∞from
␈↓them.␈α
HAL␈α
supplies␈αa␈α
method␈α
for␈αinsuring␈α
that␈α
every␈αtime␈α
the␈α
arm␈αapproaches␈α
a␈α
frame,␈α
it␈αwill
␈↓pass␈αthrough␈α
some␈αassociated␈αspot␈α
first,␈αand␈α
every␈αtime␈αit␈α
leaves␈αthat␈αframe,␈α
it␈αpasses␈α
once␈αagain
␈↓through␈α~the␈α~same␈α~spot.␈α~ The␈α~"spot"␈α~is␈α~termed␈α~a␈α~DEPROACH␈α~(from␈α≠DEParture␈α~and
␈↓apPROACH),␈α∂and␈α⊂is␈α∂really␈α∂a␈α⊂transformation␈α∂to␈α∂be␈α⊂applied␈α∂to␈α∂the␈α⊂frame␈α∂involved␈α∂in␈α⊂order␈α∂to
␈↓discover␈αthe␈α
appropriate␈αplace␈α
through␈αwhich␈α
to␈αpass.␈αThe␈α
reason␈αthat␈α
a␈αtransformation␈α
is␈αused,
␈↓and␈αnot␈αa␈αframe␈αitself,␈αis␈αthat␈αdeproaches␈α
are␈αoften␈αused␈αfor␈αlarge␈αobjects,␈αlike␈αthe␈αtable,␈α
and␈αthe
␈↓proper␈α∞point␈α∞to␈α∞pass␈α∂through␈α∞in␈α∞that␈α∞case␈α∂is␈α∞10␈α∞centimeters␈α∞above␈α∂where␈α∞the␈α∞hand␈α∞is␈α∂meant␈α∞to
␈↓arrive␈αon␈α
the␈αtable␈α
(or␈αabove␈α
where␈αthe␈α
hand␈αcurrently␈αis␈α
on␈αthe␈α
table,␈αif␈α
a␈αdeparture␈α
is␈αmeant),
␈↓not the point 10 centimeters above the table origin.
␈↓One␈αspecifies␈αthe␈α
deproach␈αof␈αan␈α
object␈αby␈αmaking␈α
an␈αassertion;␈αfor␈α
example,␈αthe␈αdeproach␈αof␈α
the
␈↓table is automatically asserted as follows (see subsection 4.7.1 concerning assertions):
␈↓ ASSERT FACT (DEPROACH TABLE [(0,0,10) | (0,0,0)]) .
␈↓This means that the correct departure point from a spot S on the table will be
␈↓ [(0,0,10) | (0,0,0)] * S .
␈↓As an object moves about in space, its deproach point moves as well. Thus
␈↓ ASSERT FACT (DEPROACH FROB [(0,10,0) | (0,0,0)])
␈↓means␈α
that␈αno␈α
matter␈α
where␈αthe␈α
frob␈α
may␈αgo,␈α
its␈α
deproach␈αwill␈α
be␈α
10␈αcentimeters␈α
in␈αthe␈α
y-direction
␈↓away from its origin, as measured in its own coordinate system.
␈↓What␈αif␈αthe␈α
hand␈αis␈αnot␈αat␈α
FROB,␈αbut␈αwishes␈α
to␈αuse␈αits␈αdeproach?␈α
This␈αalso␈αis␈αhandled␈α
correctly;
␈↓the␈αdeproach␈αpoint␈αwill␈αbe␈α10␈αcentimeters␈αin␈αFROB's␈αy-direction␈αfrom␈αwherever␈αthe␈αhand␈α
actually
␈↓is.
␈↓Deproaches,␈αbeing␈α
transformations,␈αalso␈α
have␈αthe␈αpower␈α
to␈αinclude␈α
rotations.␈αThese␈αare␈α
considered
␈↓to␈α
be␈α
rotations␈α
about␈α
the␈α
origin␈α
of␈α∞the␈α
coordinate␈α
system␈α
involved;␈α
the␈α
rotation␈α
occurs,␈α∞as␈α
usual,
␈↓before translation. Thus
␈↓ ASSERT FACT (DEPROACH FROB [(5,0,0) | (0,0,90)])
␈↓has␈αthe␈αeffect␈αthat␈αwhenever␈αFROB's␈αdeproach␈αis␈αused␈αfrom␈αany␈αframe,␈αthe␈αdeproach␈α
frame␈αwill
␈↓be␈α⊂the␈α⊂given␈α⊃frame,␈α⊂rotated␈α⊂about␈α⊃FROB's␈α⊂origin␈α⊂by␈α⊃90␈α⊂degrees␈α⊂in␈α⊃Z,␈α⊂and␈α⊂then␈α⊃translated␈α⊂5
␈↓centimeters in FROB's X direction.
␈↓Suppose␈α
that␈α
a␈α
frame␈α
F␈α
is␈α
given␈α
deproach␈α
transformation␈α
D.␈α
It␈α
is␈α
desired␈α
to␈α
find␈α
the␈αframe␈α
which
␈↓is␈αthe␈αdeproach␈αpoint␈αfrom␈αsome␈αother␈α
frame␈αH␈α(for␈αexample,␈αwhere␈αdhe␈αhand␈αis,␈α
for␈αdeparture),
␈↓using F's deproach. The frame which is used is
␈↓ F * D * (F→TABLE) * H .
␈↓4.4.4␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∩MOTIONS␈↓
aPage 31
␈↓If H = F, then the identities
␈↓ (F → TABLE) * F = TABLE, and X * TABLE =X .
␈↓reduce the expression for F's deproach to F * D.
␈↓When␈α
an␈α
arm␈α∞moves␈α
to␈α
a␈α∞frame,␈α
this␈α
is␈α
how␈α∞the␈α
deproach␈α
point␈α∞is␈α
calculated:␈α
The␈α∞frames␈α
own
␈↓deproach␈αis␈αused,␈α
if␈αit␈αhas␈α
one.␈α If␈αnot,␈αthen␈α
a␈αsearch␈αis␈α
made␈αup␈αthe␈α
ladder␈αof␈αattachment␈α(that␈α
is,
␈↓frames␈αto␈αwhich␈αthe␈αgiven␈αframe␈αis␈αattached␈αare␈αsearched)␈αuntil␈αone␈αis␈αfound␈αwith␈αa␈αdeproach.␈α If
␈↓none␈α
at␈α
all␈α
is␈αfound,␈α
then␈α
the␈α
table's␈αdeproach␈α
is␈α
used␈α
as␈αa␈α
default.␈α
(One␈α
way␈αto␈α
think␈α
of␈α
this␈αis␈α
to
␈↓consider␈αall␈α
frames␈αultimately␈α
attached␈αto␈α
the␈αtable.)␈α
In␈αapproaching␈α
a␈αframe␈α
which␈αis␈α
the␈αresult␈α
of
␈↓a␈αcalculation␈α(such␈αas␈αMOVE␈αYELLOW␈αTO␈αFROB␈α+␈α(0,0,1))␈αthe␈αdefault␈αdeproach␈αis␈αnull.␈α The
␈↓default deproach of ⊗ is also null.
␈↓In␈αdeparting␈αfrom␈αa␈αframe,␈αit␈αmatters␈αwhether␈αor␈αnot␈αthat␈αframe␈αis␈αnow␈αattached␈αto␈αthe␈αhand.␈α If
␈↓not,␈αthen␈αthe␈αsame␈αalgorithm␈αfor␈αfinding␈αdeproach␈αis␈αused␈αas␈αin␈αthe␈αcase␈αof␈αapproach.␈αBut␈αif␈αthe
␈↓frame␈α
has␈α
been␈α
detached␈αfrom␈α
some␈α
erstwhile␈α
mother␈αand␈α
is␈α
now␈α
attached␈αto␈α
the␈α
hand,␈α
then␈αits
␈↓old␈αmother's␈αdeproach␈αis␈αused␈α(and␈αif␈αthere␈αis␈αnone,␈αthe␈αsame␈αsearch␈αis␈αmade).␈α A␈αframe␈αattached
␈↓to␈αthe␈αhand␈αstill␈α
has␈αsome␈α"memory"␈αof␈α
its␈αprevious␈αstate␈αof␈α
attachment,␈αby␈αmeans␈αof␈αan␈α
automatic
␈↓WAS_ATTACHED assertion which will be mentioned in Section 4.5.
␈↓All␈α⊂of␈α⊂the␈α∂automatic␈α⊂generation␈α⊂of␈α⊂deproach␈α∂points␈α⊂can␈α⊂be␈α∂explicitly␈α⊂overridden␈α⊂in␈α⊂a␈α∂MOVE
␈↓statement by means of the USING clause. This can take two forms:
␈↓ USING APPROACH = NIL; COMMENT: No approach point at all is used;
␈↓ USING APPROACH = DEPROACH(frob); COMMENT: frob's deproach is used;
␈↓Note␈α∞that␈α∞the␈α∞word␈α∞APPROACH␈α∞could␈α∂be␈α∞replaced␈α∞by␈α∞DEPROACH␈α∞in␈α∞both␈α∞of␈α∂the␈α∞examples
␈↓above.
␈↓␈↓β4.4.5 COMPLEX MOVES␈↓
␈↓A␈αcomplex␈αmove␈αis␈αone␈αwhich␈αinvolves␈αmore␈αthan␈αone␈αarm␈αat␈αa␈αtime.␈α A␈αdistinction␈αcan␈αbe␈αmade
␈↓between␈α∞moves␈α∞which␈α∞merely␈α∞require␈α∞simultaneous␈α∞acquisition␈α∞of␈α∞"agreement␈α∞points"␈α∞(let␈α∂us␈α∞call
␈↓this␈α∪weak␈α∀synchrony),␈α∪and␈α∪those␈α∀which␈α∪require␈α∪true␈α∀coordinated␈α∪motion␈α∀throughout␈α∪(strong
␈↓synchrony).
␈↓Weak␈α
synchrony␈α
is␈α
achieved␈α
by␈α
pairing␈α
frames␈α
to␈α
make␈α
composite␈α
VIA␈α
points␈α∞and␈α
destinations.
␈↓A␈α∞paired␈α∞frame␈α∞has␈α∞the␈α
form:␈α∞{F1,␈α∞F2}.␈α∞ Here␈α∞is␈α∞an␈α
example␈α∞of␈α∞a␈α∞move␈α∞statement␈α∞using␈α
paired
␈↓frames:
␈↓ MOVE {YELLOW, BLUE}
␈↓ VIA {Y1,B1},{Y2,*},{Y3,B2}
␈↓ TO {Y4,B3}
␈↓ ON {FORCE(Z)>3,*} DO STOP
␈↓Page 32␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α9MOTIONS␈↓ ∂4.4.5
␈↓The␈αvia␈αlist␈αis␈αcomposed␈αof␈αa␈αset␈αof␈αpaired␈αframes,␈αwhere␈α*␈αindicates␈α"don't␈αcare".␈α In␈αthe␈αexample
␈↓shown,␈αthe␈αarms␈αstart␈αtogether,␈αachieve␈αY1␈αand␈αB1␈αsimultaneously,␈αthe␈αyellow␈αarm␈αpasses␈αthrough
␈↓Y2, and together they pass through Y3 and B2.
␈↓It␈α∩is␈α∩now␈α∪more␈α∩cumbersome␈α∩to␈α∪specify␈α∩ON␈α∩monitors,␈α∩or␈α∪conditions␈α∩in␈α∩general.␈α∪ The␈α∩paired
␈↓construct applies for all the optional fields; thus, one can write
␈↓ USING FORCE={3*Z,(2*Y) WRT @}
␈↓to␈α⊂get␈α⊂the␈α∂yellow␈α⊂arm␈α⊂applying␈α∂a␈α⊂force␈α⊂of␈α∂strength␈α⊂3*Z,␈α⊂and␈α∂the␈α⊂blue␈α⊂one␈α∂to␈α⊂have␈α⊂a␈α⊂force␈α∂of
␈↓strength 2*Y in the coordinate system of the blue hand.
␈↓The␈α
meaning␈α
of␈α
⊗␈α
and␈α
@␈α
is␈α
now␈α
relative␈α∞to␈α
which␈α
side␈α
of␈α
the␈α
pair␈α
they␈α
occupy;␈α
in␈α∞the␈α
example
␈↓above,␈α
the␈αleft␈α
side␈α
always␈αrefers␈α
to␈αthe␈α
yellow␈α
arm,␈αand␈α
the␈αright␈α
side␈α
to␈αthe␈α
blue.␈α
To␈αoverride
␈↓this convention, one may use expressions like "@.YELLOW", or "⊗.BLUE".
␈↓The␈α
meaning␈α
of␈α
STOP␈α
in␈α
the␈α
example␈α
above␈α
is␈α
extended␈α
to␈α
both␈α
arms␈α
at␈α
once;␈α
in␈α
order␈α
to␈α
specify
␈↓only one, it is necessary to say "STOP YELLOW" or "STOP BLUE".
␈↓Strong␈αsynchrony␈αinvolves␈α
one␈αconcept␈αnot␈α
included␈αabove:␈αThe␈αability␈α
to␈αspecify␈αthe␈α
location␈αof
␈↓one␈α
arm␈α
throughout␈αthe␈α
motion␈α
in␈αterms␈α
of␈α
the␈αlocation␈α
of␈α
the␈αother␈α
arm.␈α
The␈α
construct␈αwhich
␈↓allows␈αthis␈α
specification␈αis␈α
COORDINATING;␈αit␈αallows␈α
one␈αto␈α
give␈αan␈α
expression␈αfor␈αthe␈α
location
␈↓of␈α
one␈αof␈α
the␈αtwo␈α
arms.␈α Suppose␈α
we␈αwish␈α
to␈αkeep␈α
both␈αarms␈α
in␈α"lockstep",␈α
that␈αis,␈α
the␈α
blue␈αarm
␈↓should␈α⊃retain␈α⊂its␈α⊃relative␈α⊃position␈α⊂to␈α⊃the␈α⊃yellow␈α⊂arm␈α⊃throughout␈α⊃the␈α⊂motion.␈α⊃ (This␈α⊃might␈α⊂be
␈↓necessary for lifting some object by its two ends.) One way to code this task is as follows:
␈↓ MOVE {YELLOW, BLUE}
␈↓ TO {Y1, *}
␈↓ VIA {YA,BA},{YB,BB}
␈↓ COORDINATING LOC.BLUE = LOC.YELLOW + ⊗.BLUE - ⊗.YELLOW
␈↓ USING FREE = {*, @.YELLOW - @.BLUE}
␈↓ {MAINTAINING ORIENT, MAINTAINING ORIENT}
␈↓␈↓β4.4.6 SEARCHES␈↓
␈↓A␈αSEARCH␈α
is␈αvery␈α
much␈αlike␈α
a␈αmove.␈α
It␈αis␈α
a␈αmeans␈α
of␈αspecifying␈α
repeated␈αaction␈α
in␈αa␈αspiral.␈α
As
␈↓with␈α∂a␈α∂MOVE,␈α∂it␈α∂is␈α∂necessary␈α∂to␈α∂name␈α∂a␈α∂controllable␈α∂frame␈α∂which␈α∂is␈α∂to␈α∂be␈α∂moved.␈α⊂ The␈α∂ON
␈↓construct is exactly as for MOVEs.
␈↓One␈αmust␈α
stipulate␈αwhat␈αthe␈α
plane␈αof␈αthe␈α
search␈αis␈αto␈α
be.␈α This␈αis␈α
accomplished␈αin␈αeither␈α
of␈αtwo
␈↓ways:␈α∀ACROSS␈α∀<plane>␈α∪means␈α∀the␈α∀search␈α∀is␈α∪to␈α∀take␈α∀place␈α∀in␈α∪the␈α∀plane␈α∀specified.␈α∀ If␈α∪the
␈↓controllable␈α
frame␈α
(say,␈α
the␈α
hand)␈α
is␈α
in␈α
fact␈α
not␈α
in␈α
that␈α
plane␈α
at␈α
the␈α
start,␈α
then␈α
the␈α
plane␈αparallel␈α
to
␈↓the␈αgiven␈αone␈αthrough␈αthe␈αhand␈αwill␈αbe␈αused.␈αIt␈αis␈αassumed␈αthat␈αthe␈αhand␈αbegins␈αat␈αthe␈αcenter␈αof
␈↓the␈α∂search.␈α⊂ The␈α∂other␈α⊂alternative␈α∂is␈α⊂to␈α∂say␈α⊂NORMAL_TO␈α∂<vector>.␈α⊂ This,␈α∂together␈α⊂with␈α∂the
␈↓location of the hand, will specify the plane you want for the search.
␈↓4.4.6␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∩MOTIONS␈↓
aPage 33
␈↓The␈α↔size␈α↔of␈α↔the␈α⊗increment␈α↔is␈α↔specified␈α↔in␈α↔a␈α⊗USING␈α↔construct.␈α↔ An␈α↔example␈α↔is␈α⊗USING
␈↓INCREMENT = 3.
␈↓The␈α⊂servo␈α⊂does␈α∂almost␈α⊂all␈α⊂the␈α∂calculating␈α⊂for␈α⊂searches;␈α∂it␈α⊂is␈α⊂fed␈α∂the␈α⊂normal␈α⊂direction␈α⊂and␈α∂the
␈↓increment size.
␈↓Most␈α
important␈α
for␈αthe␈α
search␈α
is␈α
the␈αREPEATING␈α
construct,␈α
which␈α
specifies␈αwhat␈α
motion␈α
is␈αto␈α
be
␈↓performed␈α
at␈α
each␈α
iteration.␈α
It␈α
is␈α
advisable␈α
that␈α
the␈α
motion␈α
cause␈α
the␈α
arm␈α
to␈α
return␈α
to␈α
the␈α
point␈α
at
␈↓which␈α
it␈α
began,␈α
in␈α∞order␈α
to␈α
assume␈α
the␈α
same␈α∞plane␈α
at␈α
the␈α
onset␈α
of␈α∞each␈α
iteration.␈α
If␈α
this␈α∞is␈α
not
␈↓done,␈α
then␈αthe␈α
servo␈α
will␈αmove␈α
it␈αback␈α
each␈α
time␈αanyway.␈α
When␈αthe␈α
search␈α
succeeds␈α(and␈α
it␈αis␈α
the
␈↓duty␈α
of␈α
the␈α
user␈α
to␈αspecify␈α
what␈α
success␈α
means␈α
for␈α
each␈αsearch)␈α
the␈α
search␈α
can␈α
be␈α
terminated␈αin
␈↓either␈α∞of␈α∞two␈α∞ways:␈α∂by␈α∞setting␈α∞a␈α∞flag␈α∂in␈α∞the␈α∞REPEATING␈α∞and␈α∞checking␈α∂it␈α∞with␈α∞an␈α∞ON,␈α∂or␈α∞by
␈↓using␈α
the␈α
construct␈αTERMINATE␈α
inside␈α
the␈αREPEATING␈α
at␈α
the␈α
right␈αplace.␈α
Here␈α
is␈αa␈α
complete
␈↓example:
␈↓ SEARCH YELLOW
␈↓ ACROSS P1
␈↓ REPEATING
␈↓ BEGIN
␈↓ FRAME SET;
␈↓ SET ← YELLOW;
␈↓ MOVE YELLOW TO ⊗-Z
␈↓ ON FORCE(Z) > 3 DO TERMINATE;
␈↓ MOVE YELLOW TO SET DIRECTLY;
␈↓ END
␈↓␈↓β4.4.7 CENTER␈↓
␈↓Occasionally␈αthe␈αhand␈αis␈αpositioned␈αaround␈αan␈αobject,␈α
but␈αit␈αis␈αnot␈αcertain␈αif␈αit␈αis␈α
centered.␈α One
␈↓wants␈αto␈αclose␈αthe␈αfingers␈αslowly,␈αmoving␈αthe␈αarm␈αmeanwhile␈αto␈αaccomodate␈αto␈αthe␈αlocation␈αof␈αthe
␈↓object.␈α This␈αis␈αaccomplished␈αby␈αmeans␈αof␈αthe␈αCENTER␈αcommand.␈α The␈αdirection␈αthat␈αthe␈αhand
␈↓will␈αmove␈αis␈αthe␈α
direction␈αbetween␈αits␈αfingers.␈α
All␈αthat␈αthe␈αCENTER␈α
command␈αneeds␈αis␈αthe␈α
name
␈↓of the arm being moved. The use of ON is just as in a search or any other motion.
␈↓Here is a simple example:
␈↓ CENTER BLUE
␈↓ ON SQUEEZE > 4 DO STOP
␈↓Note that this is command, unlike MOVE, treats the fingers and the arm together as one device.
␈↓Page 34␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α9MOTIONS␈↓ ∂4.4.8
␈↓␈↓β4.4.8 CONSTANT VELOCITY MOTION␈↓
␈↓A␈α⊂special␈α⊂form␈α⊂of␈α⊂the␈α⊃MOVE␈α⊂instruction␈α⊂is␈α⊂provided␈α⊂to␈α⊃cause␈α⊂the␈α⊂arm␈α⊂to␈α⊂quickly␈α⊃achieve␈α⊂a
␈↓particular velocity, and to hold it in straight-line motion for a given distance:
␈↓ MOVE YELLOW
␈↓ VELOCITY=V1
␈↓ THROUGH T
␈↓ FOR DISTANCE=4 .
␈↓The␈αVELOCITY␈αclause␈αtells␈αwhich␈αvector␈αto␈αfollow,␈αand␈αhow␈αfast.␈αThe␈αTHROUGH␈αclause␈αtells
␈↓the␈αcompiler␈αwhere␈αthe␈α
move␈αexpects␈αto␈αend.␈αThe␈α
FOR␈αDISTANCE␈αtells␈αthe␈α
maximum␈αdistance
␈↓the␈αhand␈αshould␈αgo.␈αIt␈αis␈αassumed␈αthat␈αsuch␈αa␈αmove␈αwill␈αnormally␈αterminate␈αby␈αan␈αON␈αtest.␈α For
␈↓example:
␈↓ MOVE YELLOW
␈↓ WITH VELOCITY=V1
␈↓ THROUGH T
␈↓ FOR DISTANCE=4
␈↓ ON FORCE(V1) > 2 DO STOP
␈↓␈↓β4.4.9 DEVICE CONTROL␈↓
␈↓Generally,␈αan␈αarm␈αwill␈αstop␈αits␈αmotion␈αwhen␈αit␈αhas␈αachieved␈αits␈αdestination.␈α Often␈αit␈αis␈αnecessary
␈↓to␈α∂stop␈α∂it␈α∂prematurely,␈α∂for␈α∂example,␈α∂if␈α∂some␈α∂error␈α∂condition␈α∂is␈α∂detected.␈α∂ The␈α∂statement␈α∞STOP
␈↓YELLOW␈α∪causes␈α∪the␈α∪yellow␈α∪arm␈α∀to␈α∪be␈α∪unconditionally␈α∪stopped,␈α∪and␈α∪any␈α∀motion␈α∪statement
␈↓operating␈αit␈αwill␈αterminate.␈αEach␈αdevice␈αhas␈αa␈αname,␈αand␈αcan␈αbe␈αstopped␈αby␈αname.␈α Currently,␈αthe
␈↓legal␈αdevice␈αnames␈αare␈αYELLOW,␈α
BLUE,␈αVICE,␈αDRIVER␈α(an␈αelectric␈αscrewdriver),␈α
YFINGERS,
␈↓BFINGERS␈α(The␈αfingers␈αof␈α
the␈αtwo␈αarms).␈αSTOP␈α
without␈αany␈αdevice␈αname␈α
is␈αonly␈αlegal␈αwithin␈α
a
␈↓motion command; it stops whatever device(s) that command is operating.
␈↓There␈αis␈α
a␈αgeneral␈α
command␈αfor␈αoperating␈α
devices␈αother␈α
than␈αarms;␈αit␈α
is␈αhoped␈α
that␈αthis␈α
will␈αbe
␈↓flexible␈α
enough␈α
for␈α
any␈α
device␈α
we␈α
are␈α
likely␈α
to␈α
use␈α
(if␈α
not,␈α
we␈α
will␈α
add␈α
special␈α
new␈α
forms).␈α
Assume
␈↓we␈α⊂have␈α⊂the␈α⊂device␈α⊂TURNTABLE,␈α⊂which␈α⊂is␈α∂capable␈α⊂of␈α⊂moving␈α⊂at␈α⊂any␈α⊂velocity␈α⊂and␈α⊂for␈α∂any
␈↓length of time, but which cannot go to a particular set point. Then the syntax would be this:
␈↓ OPERATE TURNTABLE
␈↓ WITH VELOCITY=3
␈↓ WITH DURATION=8
␈↓The␈α∞idea␈α∞is␈α∞that␈α∂the␈α∞WITH␈α∞construct␈α∞will␈α∂suffice␈α∞to␈α∞account␈α∞for␈α∂any␈α∞special␈α∞data␈α∞(in␈α∂this␈α∞case,
␈↓velocity␈α
and␈α
duration)␈α
peculiar␈α
to␈α
the␈α
particular␈α
device.␈α
The␈α
OPERATE␈α
statement␈α
also␈α
allows␈α
the
␈↓ON construct, so it can test for special conditions and take appropriate actions.
␈↓The␈αscrewdriver␈αis␈αa␈αhand-held␈αdevice␈αwhich␈αcan␈αbe␈αrun␈αat␈αa␈αrange␈αof␈αspeeds,␈αin␈αeither␈αdirection.
␈↓4.4.9␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∩MOTIONS␈↓
aPage 35
␈↓By␈α
convention,␈α∞a␈α
positive␈α
velocity␈α∞means␈α
clockwise,␈α
and␈α∞a␈α
negative␈α
velocity␈α∞means␈α
anticlockwise.
␈↓The␈αrelevant␈αreserved␈αword␈αis␈αVELOCITY,␈αwhich␈α
is␈αequated␈αwith␈αthe␈αname␈αof␈αa␈αscalar␈α
variable,
␈↓which␈αwill␈αbe␈αqueried␈αeach␈αtime␈αthe␈αscrewdriver␈αservo␈αwakes␈αup␈αto␈αdetermine␈αhow␈αmuch␈αvoltage
␈↓to␈α∂apply␈α∂to␈α∂the␈α∂motor.␈α∂ This␈α∂allows␈α∂the␈α∞velocity␈α∂to␈α∂change␈α∂during␈α∂the␈α∂operation␈α∂of␈α∂the␈α∞device,
␈↓perhaps under the control of a parallel process which is monitoring some conditions. An example:
␈↓ OPERATE DRIVER
␈↓ WITH VELOCITY=SP
␈↓ ON DURATION>4 DO STOP
␈↓ ON DURATION>2 DO SP ← 2*SP
␈↓Each␈αarm␈αhas␈αtwo␈αfingers␈αat␈αthe␈αend␈αwhich␈αare␈αcapable␈αof␈αclosing␈αand␈αopening␈αat␈αvarious␈αspeeds.
␈↓The␈α
relevant␈α∞reserved␈α
words␈α∞are␈α
OPENING,␈α∞which␈α
is␈α∞to␈α
be␈α∞set␈α
to␈α∞the␈α
desired␈α∞(scalar)␈α
opening,
␈↓and␈α∂VELOCITY,␈α∂which␈α∞is␈α∂to␈α∂be␈α∂set␈α∞to␈α∂the␈α∂speed␈α∞desired.␈α∂ It␈α∂is␈α∂possible␈α∞to␈α∂refer␈α∂to␈α∂the␈α∞scalar
␈↓variable SQUEEZE, which indicates the force being applied by the fingers. An example:
␈↓ OPERATE FINGERS
␈↓ WITH OPENING=4
␈↓ WITH VELOCITY=2
␈↓ ON SQUEEZE > 3 DO STOP
␈↓␈↓∧4.5 ATTACHMENT␈↓
␈↓Assembly␈αoften␈αinvolves␈α
affixing␈αone␈αobject␈α
to␈αanother.␈α HAL␈α
has␈αa␈αmechanism␈α
to␈αautomatically
␈↓keep␈α∩track␈α∪of␈α∩the␈α∩location␈α∪of␈α∩a␈α∩subsidiary␈α∪piece␈α∩of␈α∩the␈α∪assembly␈α∩as␈α∩its␈α∪base␈α∩is␈α∪moved;␈α∩the
␈↓mechanism␈αis␈αcalled␈αattachment.␈α For␈αexample,␈αthere␈αmight␈αbe␈αa␈αframe␈αcalled␈αPUMP␈αand␈αa␈α
frame
␈↓called␈α
BASE.␈α
At␈α
some␈α
stage␈α
in␈α
the␈α
assembly,␈α
the␈α
pump␈α
is␈α
bolted␈α
to␈α
the␈α
base.␈α
At␈α
this␈α
time␈α
it␈α
is
␈↓appropriate to include the statement
␈↓ ATTACH PUMP TO BASE
␈↓The␈α
effect␈α
of␈αthis␈α
is␈α
severalfold:␈αIt␈α
informs␈α
the␈α
compiler␈αthat␈α
motions␈α
of␈αBASE␈α
are␈α
to␈α
affect␈αthe
␈↓location of PUMP, it generates the assertion
␈↓ ASSERT FACT (ATTACHED PUMP BASE)
␈↓and␈α
it␈αcauses␈α
code␈α
to␈αbe␈α
generated␈α
for␈αthe␈α
runtime␈αwhich␈α
will␈α
automatically␈αupdate␈α
the␈α
value␈αof
␈↓PUMP␈αevery␈αtime␈αBASE␈αis␈αchanged.␈α Please␈αnote␈αthat␈αthe␈αATTACH␈αstatement␈αdoes␈αnot␈αact␈αas␈αa
␈↓library␈α∂routine␈α∂invocation;␈α∂it␈α∂does␈α∂not␈α⊂generate␈α∂code␈α∂to␈α∂actually␈α∂perform␈α∂the␈α⊂bolting␈α∂operation.
␈↓The␈αstatement␈αmerely␈αinforms␈αthe␈αHAL␈αsystem␈αthat␈αat␈αthis␈αstage␈αin␈αthe␈αexecution␈αof␈αthe␈αprogram,
␈↓PUMP is to be considered attached to BASE.
␈↓Page 36␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∩ATTACHMENT␈↓ $4.5
␈↓If␈α
PUMP␈α
should␈α
be␈α
moved␈α
while␈α
attached␈α
to␈α
BASE,␈α
the␈α
value␈α
of␈α
BASE␈α
itself␈α
will␈α
not␈αchange,␈α
but
␈↓the␈αattachment␈αwill␈α
remain␈αfor␈αthe␈α
new␈αrelative␈αpositions␈α
of␈αPUMP␈αand␈α
BASE.␈α Occasionally␈αit␈α
is
␈↓desired␈α
that␈α
the␈α
attachment␈α
be␈α
symmetric,␈α
so␈α
that␈αmotion␈α
of␈α
either␈α
frame␈α
will␈α
cause␈α
the␈α
other␈αto
␈↓move. This is done by including the reserved word RIGIDLY in the attach statement:
␈↓ ATTACH PUMP TO BASE RIGIDLY
␈↓A␈α∩more␈α⊃precise␈α∩definition␈α⊃of␈α∩attachment␈α⊃in␈α∩terms␈α⊃of␈α∩graph␈α⊃structures␈α∩is␈α⊃given␈α∩in␈α⊃subsection
␈↓4.6.1.␈α∞ Here,␈α∞we␈α∞should␈α∞point␈α∞out␈α∞that␈α∞the␈α∞system␈α∞uses␈α∞a␈α∞trans␈α∞to␈α∞store␈α∞the␈α∞relative␈α∞positions␈α∞(in
␈↓our␈αexample,␈α"(BASE␈α→␈α
PUMP)"␈α)␈αof␈αthe␈αattached␈α
frames.␈α Normally,␈αthe␈αsystem␈αwould␈α
invent␈αa
␈↓temporary␈αvariable␈αto␈αhold␈αthis␈αtrans;␈αhowever,␈α
the␈αuser␈αcan␈αsupply␈αher␈αown␈αvariable␈αto␈α
be␈αused
␈↓instead,␈α
thus␈α
allowing␈α
her␈αto␈α
modify␈α
directly␈α
the␈α
attachment␈αrelation.␈α
This␈α
is␈α
done␈α
by␈αincluding
␈↓the phrase "BY <transform variable id>" in the ATTACH statement. For instance,
␈↓ ATTACH PUMP TO BASE BY T1;
␈↓If␈αthe␈αvalue␈αof␈αthe␈αtrans␈αis␈αmodified␈αin␈αa␈αnon-rigid␈α(that␈αis,␈αassymetric)␈αattachment,␈αthe␈αeffect␈αis␈α
to
␈↓move␈α
the␈αsubsidiary␈α
frame.␈α
If␈αthe␈α
value␈αof␈α
the␈α
trans␈αchanges␈α
in␈αa␈α
rigid␈α
(symmetric)␈αattachment,
␈↓then␈αneither␈α
frame␈αwill␈αchange␈α
its␈αvalue␈α
until␈αone␈αof␈α
them␈αexplicitly␈α
gets␈αa␈αnew␈α
value;␈αat␈αthat␈α
time
␈↓the other will spring to a new position, as determined by the trans.
␈↓The␈αinclusion␈αof␈αthe␈αconstruct␈α"AT␈α<transform␈αexpression>"␈αwill␈αcause␈αHAL␈αto␈αuse␈αthe␈αindicated
␈↓value for the relative attached position of the objects. Thus,
␈↓ ATTACH PUMP TO BASE AT [(0,0,0)|(0,0,0)]
␈↓is equivalent to
␈↓ ATTACH PUMP TO BASE BY TEMPXF;
␈↓ TEMPXF ← [(0,0,0)|(0,0,0)]
␈↓It␈αis␈αpossible␈αto␈αmake␈αchains␈αof␈αattachments,␈αpossibly␈αinvolving␈αsome␈αrigid␈αattachments␈αand␈αsome
␈↓non-rigid ones.
␈↓Attachments are undone by the DETACH statement. For example,
␈↓ DETACH PUMP FROM BASE
␈↓will␈αremove␈α
the␈αattach␈α
structure␈αbetween␈α
PUMP␈αand␈αBASE,␈α
and␈αwill␈α
discard␈αthe␈α
invented␈αtrans
␈↓(unless␈αit␈αwas␈αnamed,␈αof␈αcourse).␈α Two␈αchanges␈αin␈αthe␈αcompiler's␈αassertional␈αdata␈αbase␈αwill␈αalso␈αbe
␈↓generated (See the section on assertions):
␈↓ DENY FACT (ATTACHED PUMP BASE);
␈↓ ASSERT FACT (WAS_ATTACHED PUMP BASE)
␈↓The␈α∪latter␈α∪assertion␈α∪is␈α∪used␈α∪in␈α∪calculation␈α∪of␈α∪default␈α∪deproach␈α∪points.␈α∪A␈α∪side-effect␈α∪of␈α∪any
␈↓assignment, like F1 ← <value>, is
␈↓4.5␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α:ATTACHMENT␈↓
aPage 37
␈↓ DENY FACT (WAS_ATTACHED ANYTHING F1);
␈↓ DENY FACT (WAS_ATTACHED F1 ANYTHING) .
␈↓␈↓∧4.6 GRAPH STRUCTURES␈↓
␈↓Attachments␈αare␈α
stored␈αin␈αboth␈α
the␈αcompiler␈αand␈α
the␈αruntime␈α
as␈αa␈αgraph␈α
structure.␈α The␈αnature␈α
of
␈↓this␈α∪structure␈α∪is␈α∪described␈α∪in␈α∪subsection␈α∪6.2.2;␈α∪the␈α∪algorithms␈α∪which␈α∪serve␈α∪to␈α∀extract␈α∪values
␈↓from␈αa␈αgraph␈α
and␈αinsert␈αnew␈α
values␈αinto␈αit␈α
can␈αbe␈αfound␈α
in␈αAppendix␈αII.␈α
Suffice␈αit␈αhere␈α
to␈αsay
␈↓that␈α∞if␈α∞the␈α∞value␈α∞of␈α∞a␈α∞variable␈α∞is␈α∞needed,␈α∞and␈α∞that␈α∞value␈α∞is␈α∞marked␈α∞as␈α∞invalid,␈α∞then␈α∞the␈α∞list␈α
of
␈↓calculator␈α
expressions␈α
for␈α
that␈α
variable␈α
is␈α
searched␈α
for␈α
one␈α
which␈α
can␈α
compute␈α
a␈α
valid␈α∞value;␈α
if
␈↓none␈α∂of␈α∂the␈α∂calculators␈α∂will␈α∂work␈α∂(e.g.␈α∂they␈α∂all␈α∂depend␈α∂themselves␈α∂on␈α∂invalid␈α∂values),␈α⊂then␈α∂the
␈↓current␈α(invalid)␈αvalue␈αis␈αreturned␈αas␈αthe␈αbest␈αanswer␈αavailable.␈αWhen␈αa␈αnew␈αvalue␈αis␈αassigned␈αto
␈↓a␈αvariable,␈αall␈αthose␈αvalues␈αwhose␈αcalculators␈αdepend␈αon␈αthe␈αnew␈αvalue␈αare␈αmarked␈αas␈αinvalid,␈αso
␈↓that␈α∂the␈α∂next␈α∂time␈α∂they␈α∂are␈α∂needed,␈α∂graph␈α∂searching␈α∂is␈α∂performed.␈α∂Building␈α∂a␈α⊂graph␈α∂structure
␈↓therefore␈α∩involves␈α∩specifying␈α∩the␈α∩calculators␈α∩for␈α∩all␈α∩variables.␈α∩ Usually,␈α∩this␈α∩will␈α∩be␈α∪be␈α∩done
␈↓implicitly␈αby␈αmeans␈αof␈α"intuitively␈α
obvious"␈αstatements␈αlike␈αATTACH␈αand␈α
DETACH.␈α However,
␈↓HAL␈αalso␈αsupplies␈αprimitives␈αfor␈αexplicit␈αmanipulation␈αof␈αgraph␈αstructure.␈α The␈αprincipal␈αexplicit
␈↓means employed for this purpose is the "graph assignment statement":
␈↓ <variable> <= <expression>
␈↓where␈α"<="␈αmay␈αbe␈αread␈α"is␈αcomputed␈αby".␈α This␈αconstruct␈αcauses␈α<expression>␈αto␈αbe␈αadded␈αto␈αthe
␈↓list of calculators for <variable>. Similarly,
␈↓ <variable> <␈↓ε≠␈↓ <expression>
␈↓causes <expression> to be removed from the list of calculators, and
␈↓ <variable> <<= <expression>
␈↓replaces the current calculator list for <expression>. The statement
␈↓ <variable> <<= ;
␈↓would cause the calculator list to be set to null.
␈↓It␈α
is␈α
frequently␈α∞very␈α
inconvenient␈α
to␈α∞retype␈α
an␈α
entire␈α∞expression␈α
in␈α
order␈α∞to␈α
remove␈α
it␈α∞from␈α
the
␈↓calculator␈α∞list.␈α∂ HAL␈α∞allows␈α∞the␈α∂user␈α∞to␈α∂attach␈α∞a␈α∞name␈α∂to␈α∞an␈α∞expression␈α∂in␈α∞a␈α∂graph␈α∞assignment
␈↓statement by use of the construct
␈↓ <variable> <= "id" <expression>
␈↓Then the construct
␈↓Page 38␈α?␈α?␈α?␈α?␈α?␈α?␈α≥GRAPH STRUCTURES␈↓ $4.6
␈↓ <variable> <␈↓ε≠␈↓ "id"
␈↓will remove the named expression from the calculator list. For instance,
␈↓ F1 <= "foo" T*F2;
␈↓ :
␈↓ F1 <␈↓ε≠␈↓ "foo";
␈↓would have the same effect as
␈↓ F1 <= T*F2;
␈↓ :
␈↓ F1 <␈↓ε≠␈↓ T*F2;
␈↓In␈α∂addition␈α∂to␈α∂the␈α∂calculator␈α∂list,␈α∂a␈α∂list␈α∂of␈α∂"updater"␈α∂routines␈α∂is␈α∂associated␈α∂with␈α⊂every␈α∂variable.
␈↓These␈α
routines␈αare␈α
executed␈α
whenever␈αthe␈α
variable␈α
value␈αis␈α
changed.␈α
Initially,␈αthe␈α
list␈αof␈α
updaters
␈↓is null. However, the construct
␈↓ WHEN CHANGING <variable> ALSO DO "<id>" <statement>;
␈↓will␈α
cause␈α<statement>␈α
to␈αbe␈α
added␈αto␈α
the␈αlist␈α
of␈αupdaters␈α
for␈α<variable>.␈α
("<id>"␈αis␈α
optional,␈αbut␈α
is
␈↓necessary␈α∂if␈α⊂the␈α∂<statement>␈α∂is␈α⊂ever␈α∂to␈α∂be␈α⊂removed␈α∂from␈α∂the␈α⊂updater␈α∂list.)␈α∂In␈α⊂<statement>,␈α∂the
␈↓reserved␈α∪words␈α∩OLD␈α∪and␈α∩NEW␈α∪may␈α∪be␈α∩used␈α∪to␈α∩refer␈α∪to␈α∪the␈α∩old␈α∪and␈α∩new␈α∪values␈α∪of␈α∩var,
␈↓respectively. For instance:
␈↓ WHEN CHANGING F2 ALSO DO "foo" F1←NEW*(OLD→F1);
␈↓Updaters may be removed from the updater list by the statement
␈↓ WHEN CHANGING <variable> DONT DO "<id>"
␈↓For our above example, this would be
␈↓ WHEN CHANGING F2 DONT DO "foo";
␈↓The form
␈↓ WHEN CHANGING <variable> ONLY DO <statement>;
␈↓replaces the updater list with one containing just <statement>, and
␈↓ WHEN CHANGING <variable> ONLY DO ;
␈↓clears␈αthe␈αupdater␈αlist␈αcompletely.␈α Since␈αthe␈αattach␈αstructure␈αmakes␈αuse␈αof␈αupdater␈αand␈αcalculator
␈↓lists (see subsection 6.2.2), careless use of the replacement form is not advised.
␈↓One good use for updater routines is tracing. For example,
␈↓4.6␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αεGRAPH STRUCTURES␈↓
aPage 39
␈↓ WHEN CHANGING V ALSO DO
␈↓ WRITE("The value of V is now ",NEW);
␈↓Details␈α∂of␈α∂the␈α∂graph␈α∂structure␈α∂algorithms␈α∂may␈α∂be␈α∂found␈α∂in␈α∂the␈α∂appendix␈α∂on␈α⊂runtime␈α∂routines.
␈↓One␈α
additional␈α
point␈α
that␈α
should␈α
be␈α
mentioned␈α
here␈α
is␈α
that␈α
the␈α
updater␈α
routines␈α
for␈α∞a␈α
variable
␈↓are␈α
NOT␈α
called␈αif␈α
the␈α
variable's␈αvalue␈α
is␈α
modified␈αas␈α
a␈α
side␈αeffect␈α
of␈α
a␈αchange␈α
to␈α
some␈αvariable␈α
in
␈↓one of its calculators.
␈↓␈↓β4.6.1 CONCERNING ATTACH AND DETACH␈↓
␈↓The ATTACH and DETACH statements are defined by their effects on the graph structures.
␈↓ ATTACH F1 TO F2 BY T1
␈↓is equivalent to
␈↓ T1 ← F2→F1;
␈↓ F1 <= "xxx" T1 * F2;
␈↓ WHEN CHANGING F1 ALSO DO "yyy" T1←(F2→NEW);
␈↓ ASSERT FACT (ATTACHED F1 F2 T1);
␈↓ Comment : For details of ASSERT see subsection 4.7.1;
␈↓Then,
␈↓ DETACH F1 FROM F2;
␈↓is equivalent to
␈↓ F1 <␈↓ε≠␈↓ "xxx";
␈↓ WHEN CHANGING F1 DONT DO "yyy";
␈↓ DENY FACT(ATTACHED F1 F2 ANYTHING);
␈↓ ASSERT FACT (WAS_ATTACHED F1 F2);
␈↓Similarly,
␈↓ ATTACH F1 TO F2 BY T1 RIGIDLY
␈↓is equivalent to
␈↓ T1 ← F2→F1;
␈↓ F1 <= T1 * F2;
␈↓ F2 <= INVERSE(T1) * F1 .
␈↓Page 40␈α?␈α?␈α?␈α?␈α?␈α~COMPILE-TIME CONSTRUCTS␈↓ $4.7
␈↓␈↓∧4.7 COMPILE-TIME CONSTRUCTS␈↓
␈↓␈↓β4.7.1 ASSERTIONS␈↓
␈↓Although␈αthe␈αcompiler␈αmakes␈αan␈αeffort␈αto␈αkeep␈αtrack␈αof␈αthe␈αexpected␈αruntime␈αstate␈αof␈αvariables,␈αit
␈↓sometimes␈α⊂must␈α⊂be␈α⊂given␈α∂explicit␈α⊂information␈α⊂about␈α⊂what␈α∂values␈α⊂a␈α⊂variable␈α⊂might␈α⊂have.␈α∂ For
␈↓instance,␈α⊂it␈α⊂is␈α⊂difficult␈α⊂for␈α⊂the␈α⊃compiler␈α⊂to␈α⊂maintain␈α⊂unambiguous␈α⊂planning␈α⊂values␈α⊃within␈α⊂the
␈↓THEN␈αand␈αthe␈αELSE␈αparts␈αof␈αconditionals.␈αTherefore,␈αduring␈αeach␈αbranch,␈αa␈αseparate␈α"world"␈αis
␈↓in␈α
effect,␈αstemming␈α
from␈α
the␈αworld␈α
in␈αforce␈α
before␈α
the␈αIF.␈α
All␈α
variables␈αmodified␈α
in␈αeither␈α
branch
␈↓have␈αplanning␈α
value␈α"undefined"␈αat␈α
the␈αclose␈α
of␈αthe␈αconditional.␈α
Although␈αeventually␈αthe␈α
compiler
␈↓may␈α∞get␈α
smart␈α∞enough␈α∞to␈α
resolve␈α∞a␈α
number␈α∞of␈α∞such␈α
cases,␈α∞assertions␈α
must␈α∞be␈α∞used␈α
(␈α∞at␈α∞least␈α
for
␈↓now) to inform the compiler of any planning values it might need thereafter. For example:
␈↓ IF G=1 THEN
␈↓ BEGIN
␈↓ ATTACH FROB TO YELLOW;
␈↓ MOVE FROB TO HOLE;
␈↓ OPERATE YFINGERS WITH OPENING=5;
␈↓ DETACH FROB FROM YELLOW;
␈↓ MOVE YELLOW TO YPARK;
␈↓ END;
␈↓ ASSERT YELLOW=YPARK;
␈↓The␈αASSERT␈α
statement␈αtells␈α
the␈αcompiler␈α
to␈αuse␈α
YPARK␈αas␈α
the␈αplanning␈α
value␈αfor␈αYELLOW␈α
at
␈↓the␈α∞close␈α
of␈α∞the␈α
conditional.␈α∞ In␈α∞general,␈α
information␈α∞about␈α
variable␈α∞values␈α
may␈α∞be␈α∞specified␈α
by
␈↓statements of the form:
␈↓ ASSERT <expression> <relation> <constant>
␈↓The␈α<relation>␈αmust␈αbe␈α"=",␈αexcept␈αwhere␈α<expression>␈αand␈α<constant>␈αare␈αscalars,␈αin␈αwhich␈αcase
␈↓"<",">","≤",␈αand␈α"␈↓ε≥␈↓"␈α
may␈αalso␈αbe␈α
used.␈α At␈αpresent,␈α
<expression>␈αis␈αrestricted␈α
to␈αbe␈αeither␈αa␈α
variable
␈↓name or a linear form involving only scalar variables. For instance
␈↓ ASSERT V = (1 2 3);
␈↓ ASSERT F1 = #(T1) * #(F2);
␈↓␈↓ βλ␈↓β{Recall␈α
that␈α
T1␈α
is␈α
not␈α
a␈α
constant,␈α
but␈α
#(T1)␈α
--␈α
ie␈α
the␈α
current␈α
planning␈α
value␈α
of␈αT1)␈α
is.
␈↓β␈↓ βλ}
␈↓ ASSERT 3*S1 + 4*S2 ≤ 3;
␈↓Also,␈αit␈αis␈αfrequently␈αuseful␈αto␈αbe␈αable␈αto␈αspecify␈αvarious␈αsorts␈αof␈αsymbolic␈αinformation␈αwhich␈αcan
␈↓be␈α
used␈α
to␈α
direct␈α
conditional␈α
expansion␈α
of␈α
various␈α
compile-time␈α
conditionals␈α
and␈α
by␈α
the␈αvarious
␈↓high␈α∞level␈α∞primitives␈α∞(such␈α∞as␈α∞INSERT␈α∞or␈α∞GRASP)␈α∞provided␈α∞by␈α∞the␈α∞expander.␈α∞This␈α∂facility␈α∞is
␈↓provided by the construct:
␈↓ ASSERT FACT (<pattern>)
␈↓4.7.1␈α?␈α?␈α?␈α?␈α?␈α2COMPILE-TIME CONSTRUCTS␈↓
aPage 41
␈↓where <pattern> may by any sequence of identifiers and constants. For instance:
␈↓ ASSERT FACT (MACHINE TURING);
␈↓ ASSERT FACT (PAINTED ROSES RED WITH BRUSH);
␈↓ ASSERT FACT (WEIGHT ENGINE_BLOCK 4.5 POUNDS);
␈↓ ASSERT FACT (PART1 FITS_ONTO PART2 [(1,2,3):(π,0,π/2)]);
␈↓The␈α
actual␈α
meaning␈α
of␈α
an␈α
asserted␈α
pattern␈α
is␈α
generally␈α
determined␈α
by␈α
whatever␈α
conventions␈α
the
␈↓user␈αmay␈α
wish␈αto␈αestablish.␈α
However,␈αa␈α
few␈αpattern␈αtypes,␈α
such␈αas␈αthose␈α
for␈αattachment␈α
or␈αthose
␈↓used␈α∞by␈α∂the␈α∞very␈α∂high␈α∞level␈α∂routines␈α∞for␈α∂object␈α∞descriptions,␈α∂are␈α∞"understood"␈α∂and␈α∞used␈α∂by␈α∞the
␈↓compiler.␈α∂ The␈α∂user␈α∂can␈α∞cause␈α∂serious␈α∂confusions␈α∂by␈α∞improper␈α∂introduction␈α∂or␈α∂deletion␈α∂of␈α∞such
␈↓patterns.␈α∂ Generally,␈α∂assertions␈α∂will␈α∂remain␈α∂"true"␈α∂in␈α∂the␈α∂compiler's␈α∂world␈α∂model␈α∂until␈α∂explicitly
␈↓deleted␈α⊂or,␈α∂in␈α⊂the␈α∂case␈α⊂of␈α⊂assertions␈α∂used␈α⊂by␈α∂the␈α⊂compiler,␈α⊂as␈α∂a␈α⊂side␈α∂effect␈α⊂of␈α⊂processing␈α∂some
␈↓statement.␈α Any␈αassertion␈α(whether␈αof␈αa␈αfact␈αor␈αof␈αa␈αrelation)␈αmay␈αbe␈αundone␈αby␈αuse␈αof␈αthe␈α
DENY
␈↓construct,␈αwhich␈αis␈αsimilar␈αto␈αASSERT,␈αexcept␈αfor␈αthe␈αuse␈αof␈αthe␈αword␈α"DENY".␈α Thus,␈αwe␈αmight
␈↓have
␈↓ DENY V = #(V);
␈↓ DENY 4*X-5*Y = 10;
␈↓ DENY FACT (IN HAND SCREWDRIVER);
␈↓Note␈αthe␈αuse␈αof␈α#(V)␈αin␈αthe␈αfirst␈αexample␈αto␈αretrieve␈αthe␈αcurrent␈αplanning␈αvalue␈αfor␈αV.␈α After␈αthe
␈↓denial is processed, #(V) will become undefined.
␈↓Assertions may be named by inclusion of a "label" field after the word "ASSERT", as in
␈↓ ASSERT "FOO" X = 3.14;
␈↓ ASSERT "BAZ" 4*X-10*Y ␈↓ε≥␈↓ 1;
␈↓ ASSERT "FOOBAZ" FACT(IN HAND HAMMER);
␈↓This␈α∂construct␈α∂is␈α∞very␈α∂useful␈α∂for␈α∂deleting␈α∞an␈α∂assertion␈α∂without␈α∂having␈α∞to␈α∂recall␈α∂it␈α∂exactly.␈α∞ For
␈↓instance,
␈↓ DENY "BAZ";
␈↓would have the same effect as
␈↓ DENY 4*X-10*Y ␈↓ε≥␈↓ 1;
␈↓NOTE:␈α∩A␈α∩possible␈α∩source␈α⊃of␈α∩confusion␈α∩is␈α∩the␈α∩fact␈α⊃that␈α∩assertions␈α∩are␈α∩purely␈α∩a␈α⊃compile-time
␈↓construct used to direct compilation. It is not possible to view the assertional structure at runtime.
␈↓Page 42␈α?␈α?␈α?␈α?␈α?␈α~COMPILE-TIME CONSTRUCTS␈↓ ∂4.7.2
␈↓␈↓β4.7.2 CONDITIONAL EXPANSION␈↓
␈↓It␈α∂is␈α∂frequently␈α∂desirable␈α∂to␈α∂write␈α∂a␈α∂fairly␈α∂general␈α∂piece␈α∂of␈α∂source␈α∂code␈α∂that␈α∂produces␈α∂different
␈↓object␈α
code,␈α
depending␈α
on␈α
the␈α
specific␈α
task␈α
to␈α
be␈α
performed␈α
and␈α
on␈α
the␈α
compiler's␈α
model␈α∞of␈α
the
␈↓expected␈α∪runtime␈α∪environment.␈α∀ The␈α∪principal␈α∪mechanism␈α∪provided␈α∀for␈α∪this␈α∪purpose␈α∀is␈α∪the
␈↓compile-time␈αconditional␈αconstruct,␈αwhich␈αbehaves␈αlike␈αa␈αconventional␈αAlgol␈α"IF",␈αexcept␈αthat␈αit␈αis
␈↓resolved␈α
at␈α
compile␈α
time,␈α
with␈α
only␈α
the␈α
the␈α
"expanded"␈α
part␈α
having␈α
any␈α
effect␈α
on␈α
the␈αcompiler's
␈↓world model. The syntax is:
␈↓ COMPILE IF <condition> THEN
␈↓ <then-part>
␈↓ ELSE
␈↓ <else-part>
␈↓where␈α∂the␈α⊂"ELSE"␈α∂component␈α∂may␈α⊂be␈α∂omitted␈α∂if␈α⊂desired.␈α∂ The␈α∂condition␈α⊂may␈α∂be␈α⊂any␈α∂boolean
␈↓expression involving only constants. For instance:
␈↓ COMPILE IF #(BLUE)␈↓ε≠␈↓BPARK THEN
␈↓ MOVE BLUE TO BPARK;
␈↓Also, the results of symbolic assertions may be tested by means of the FACT construct, as in
␈↓ COMPILE IF FACT (IN TOOLRACK SCREWDRIVER) THEN
␈↓ BEGIN
␈↓␈↓ ∧λ␈↓β{ Code to fetch the screwdriver out of the tool rack}
␈↓ END;
␈↓When␈α⊃used␈α∩in␈α⊃this␈α∩way,␈α⊃FACT␈α∩expressions␈α⊃are␈α⊃boolean␈α∩primaries,␈α⊃and␈α∩can␈α⊃enter␈α∩into␈α⊃more
␈↓complicated boolean expressions in the usual way. For instance:
␈↓ COMPILE IF FACT(GOES_IN SHAFT1 HOLE1)
␈↓ ∧␈↓ε¬␈↓FACT(IN SHAFT1 HOLE1) THEN
␈↓ BEGIN
␈↓ COMPILE IF FACT(THREADED SHAFT1) THEN
␈↓ BEGIN
␈↓␈↓ ¬λ␈↓β{ here code to insert a threaded screw}
␈↓ ASSERT FACT (SCREWED SHAFT1);
␈↓ END
␈↓ ELSE
␈↓ BEGIN
␈↓␈↓ ¬λ␈↓β{ here code to insert a smooth pin}
␈↓ ASSERT FACT (SLIPPED_IN SHAFT1);
␈↓ END;
␈↓ ASSERT FACT (IN SHAFT1 HOLE1);
␈↓ END;
␈↓Frequently,␈αone␈αmay␈αwant␈αto␈αtest␈αa␈αwhole␈αclass␈αof␈αasserted␈αfacts␈αat␈αonce.␈αFor␈αinstance,␈αsuppose␈αwe
␈↓may␈αwant␈αto␈αknow␈αif␈αthe␈αblue␈αhand␈αis␈αavailable␈αfor␈αsome␈αtask␈αor␈αanother.␈α We␈αcan␈αkeep␈αtrack␈αof
␈↓what is in the hand by means of assertions like
␈↓4.7.2␈α?␈α?␈α?␈α?␈α?␈α2COMPILE-TIME CONSTRUCTS␈↓
aPage 43
␈↓ ASSERT FACT (BLUE HOLDS WIDGET);
␈↓However,␈αit␈αis␈αfrequently␈αinconvenient,␈αand␈αsometimes␈αimpossible,␈αexplicitly␈αto␈αtest␈αall␈αpossibilities,
␈↓as in:
␈↓ COMPILE IF ␈↓ε¬␈↓FACT(BLUE HOLDS WIDGET)
␈↓ ∧ ␈↓ε¬␈↓FACT(BLUE HOLDS FROB) ∧ . . . THEN
␈↓ BEGIN
␈↓ comment whatever;
␈↓ END;
␈↓The␈α∞reserved␈α
word␈α∞ANYTHING␈α
is␈α∞provided␈α
as␈α∞a␈α
wild␈α∞card␈α
to␈α∞avoid␈α
this␈α∞difficulty.␈α∞ Thus,␈α
we
␈↓can write:
␈↓ COMPILE IF ␈↓ε¬␈↓FACT(BLUE HOLDS ANYTHING) THEN
␈↓ BEGIN
␈↓ comment whatever;
␈↓ END;
␈↓␈↓β4.7.3 THE COMPILE-TIME CHECK STATEMENT␈↓
␈↓Since␈α
library␈α
routines␈α
will␈α
be␈α
commonly␈α
used,␈α
it␈α
is␈α
necessary␈α
to␈α
have␈α
some␈α
way␈α
of␈α
checking␈α
that
␈↓necessary␈αpreconditions␈α
are␈αmet␈αas␈α
the␈αfirst␈αsteps␈α
of␈αthe␈αlibrary␈α
routine.␈α The␈αway␈α
this␈αis␈α
done␈αis
␈↓with the CHECK statement. A simple example:
␈↓ CHECK X=3 ∧ Y>5
␈↓The␈αcontents␈αof␈αthe␈αcheck␈αmay␈αbe␈αany␈αboolean␈αexpression,␈αincluding␈αchecks␈αon␈αthe␈αcurrent␈αworld
␈↓model.␈α∂The␈α∂check␈α∂is␈α∂only␈α∂made␈α∂at␈α∂compile-time;␈α∞if␈α∂the␈α∂check␈α∂is␈α∂not␈α∂satisfied,␈α∂the␈α∂compiler␈α∞will
␈↓generate an error message. The effect of this statement is exactly like that of
␈↓ COMPILE IF ␈↓ε¬␈↓(X=3 ∧ Y>5) THEN
␈↓ COMPILE_ERROR("CHECK STATEMENT FAILED") .
␈↓␈↓β4.7.4 BINDING BOOLEANS␈↓
␈↓Frequently␈α⊃the␈α∩construct␈α⊃ANYTHING␈α⊃does␈α∩not␈α⊃suffice.␈α∩ For␈α⊃example,␈α⊃the␈α∩user␈α⊃may␈α∩want␈α⊃to
␈↓execute␈α∂different␈α∂code,␈α∂depending␈α⊂on␈α∂what␈α∂is␈α∂supposed␈α∂to␈α⊂be␈α∂in␈α∂the␈α∂blue␈α⊂hand.␈α∂ Compile-time
␈↓variables,␈α⊂which␈α⊃are␈α⊂described␈α⊂more␈α⊃fully␈α⊂in␈α⊂subsection␈α⊃4.7.7,␈α⊂provide␈α⊂a␈α⊃means␈α⊂of␈α⊃doing␈α⊂this.
␈↓Such␈α∀variables␈α∀have␈α∀no␈α∀runtime␈α∃existence␈α∀whatsoever.␈α∀ Instead,␈α∀the␈α∀compiler␈α∀can␈α∃set␈α∀their
␈↓"planning"␈α∩value␈α∩to␈α∩the␈α∪internal␈α∩structure␈α∩associated␈α∩with␈α∩any␈α∪string␈α∩of␈α∩valid␈α∩tokens␈α∪in␈α∩the
␈↓Page 44␈α?␈α?␈α?␈α?␈α?␈α~COMPILE-TIME CONSTRUCTS␈↓ ∂4.7.4
␈↓language.␈α⊃ Then,␈α∩whenever␈α⊃the␈α⊃parser␈α∩encounters␈α⊃the␈α∩"#(vi)"␈α⊃for␈α⊃compile␈α∩time␈α⊃variable␈α∩vi,␈α⊃it
␈↓substitutes␈α∞the␈α∞associated␈α∞"value".␈α∞ For␈α∞instance,␈α∞suppose␈α∞the␈α∞compile␈α∞time␈α∞variable␈α∞"HAND_ID"
␈↓has been given (by some means) the value "YELLOW". Then
␈↓ MOVE #(HAND_ID) TO FOO;
␈↓is identical to
␈↓ MOVE YELLOW TO FOO;
␈↓There␈α⊂are␈α∂a␈α⊂number␈α∂of␈α⊂ways␈α∂(discussed␈α⊂in␈α∂subsection␈α⊂4.7.7)␈α∂by␈α⊂which␈α∂a␈α⊂compile-time␈α∂variable
␈↓may given a value. One of these is the construct
␈↓ BIND(Vi)
␈↓in␈αa␈αFACT␈αpattern␈αwithin␈αa␈αboolean␈αtest.␈α BIND(Vi)␈αacts␈αsomething␈αlike␈αANYTHING␈αin␈αthat␈αit
␈↓will␈α⊃match␈α∩any␈α⊃token␈α⊃occurring␈α∩at␈α⊃a␈α⊃corresponding␈α∩place␈α⊃in␈α⊃a␈α∩pattern.␈α⊃ However,␈α⊃it␈α∩has␈α⊃the
␈↓additional␈αeffect␈αof␈αsetting␈αthe␈αplanning␈αvalue␈αof␈αVi␈αto␈αthe␈αcorresponding␈αelement␈αin␈αthe␈αmatched
␈↓pattern. For instance,
␈↓ COMPILE_TIME THING,WHERE;
␈↓ :
␈↓ ASSERT FACT (BLUE HOLDS FROB);
␈↓ ASSERT FACT (CORRECT_SPOT_FOR FROB [(1,2,3):(π,0,0)]);
␈↓ ASSERT FACT (CORRECT_SPOT_FOR WIDGET [(4,5,6):(π,0,0)]);
␈↓ :
␈↓ COMPILE IF FACT(BLUE HOLDS BIND(THING)) THEN
␈↓ BEGIN
␈↓ IF FACT (CORRECT_SPOT_FOR #(THING) BIND(WHERE)) THEN
␈↓ BEGIN
␈↓ MOVE BLUE TO #(WHERE);
␈↓ comment ... etc ... ;
␈↓ END
␈↓ ELSE
␈↓ BEGIN
␈↓ comment some sort of error message, perhaps;
␈↓ END;
␈↓ END;
␈↓Would expand into
␈↓ MOVE BLUE TO [(1,2,3):(π,0,0)];
␈↓ comment ... etc ...;
␈↓4.7.5␈α?␈α?␈α?␈α?␈α?␈α2COMPILE-TIME CONSTRUCTS␈↓
aPage 45
␈↓␈↓β4.7.5 COMPILE FOREACH␈↓
␈↓Sometimes,␈α∂there␈α⊂may␈α∂be␈α∂several␈α⊂assertions␈α∂in␈α∂the␈α⊂data␈α∂base␈α∂that␈α⊂could␈α∂satisfy␈α∂a␈α⊂given␈α∂FACT
␈↓retrieval pattern. For instance,
␈↓ ASSERT FACT(S1 SCREWS INTO H1);
␈↓ ASSERT FACT(S2 SCREWS INTO H2);
␈↓ ASSERT FACT(S3 SCREWS INTO H3);
␈↓ :
␈↓ COMPILE IF FACT(BIND(S) SCREWS INTO BIND(H)) THEN
␈↓ BEGIN
␈↓ :
␈↓ END
␈↓In␈α∩such␈α∩cases,␈α∩the␈α∩compiler␈α∩would␈α∩arbitrarily␈α∩pick␈α⊃one␈α∩of␈α∩the␈α∩eligible␈α∩patterns␈α∩to␈α∩use␈α∩as␈α⊃its
␈↓"template"␈α⊃for␈α⊃performing␈α⊃any␈α⊃requested␈α⊃bindings.␈α⊂ Suppose,␈α⊃however,␈α⊃that␈α⊃the␈α⊃user␈α⊃wants␈α⊂to
␈↓perform␈α
some␈α∞action␈α
for␈α∞each␈α
pattern␈α∞that␈α
matches,␈α∞rather␈α
than␈α∞for␈α
only␈α∞one.␈α
For␈α∞instance,␈α
she
␈↓may␈α
want␈α∞to␈α
insert␈α
all␈α∞the␈α
screws␈α∞into␈α
their␈α
corresponding␈α∞holes.␈α
The␈α∞compile-time␈α
FOREACH
␈↓construct is intended to allow this sort of thing.
␈↓ COMPILE FOREACH <condition> DO
␈↓ <statement>
␈↓where the <condition> must have the form
␈↓ FACT (<pattern>)
␈↓This␈α∂construct␈α∂will␈α∂cause␈α⊂<statement>␈α∂to␈α∂be␈α∂compiled␈α∂once␈α⊂for␈α∂each␈α∂instance␈α∂of␈α⊂<pattern>␈α∂that
␈↓finds a match in the data base.
␈↓For␈α∞instance,␈α∞a␈α∞library␈α∞routine␈α∂that␈α∞fastens␈α∞down␈α∞a␈α∞head␈α∞to␈α∂an␈α∞engine␈α∞block␈α∞by␈α∞means␈α∂of␈α∞bolts
␈↓which can be inserted in any order might include a sequence like:
␈↓ COMPILE_TIME BOLT,HOLE_ID,HEAD_ID;
␈↓ :
␈↓ COMPILE FOREACH FACT( BIND(BOLT) FASTENS #(HEAD_ID)) DO
␈↓ BEGIN
␈↓ COMPILE IF FACT(#(BOLT) FITS INTO BIND(HOLE_ID)) THEN
␈↓ INSERT #(BOLT) INTO #(HOLE_ID)
␈↓ ELSE
␈↓ BEGIN
␈↓ COMMENT an error message;
␈↓ END;
␈↓ END;
␈↓If we then have assertions:
␈↓Page 46␈α?␈α?␈α?␈α?␈α?␈α~COMPILE-TIME CONSTRUCTS␈↓ ∂4.7.5
␈↓ ASSERT FACT (B1 FASTENS PUMPHEAD);
␈↓ ASSERT FACT (B2 FASTENS PUMPHEAD);
␈↓ ASSERT FACT (B3 FASTENS PUMPHEAD);
␈↓ ASSERT FACT (B1 FITS INTO H1);
␈↓ ASSERT FACT (B2 FITS INTO H2);
␈↓ ASSERT FACT (B3 FITS INTO H3);
␈↓and call our library routine to put on PUMPHEAD, the above fragment would expand into
␈↓ :
␈↓ INSERT B1 INTO H1;
␈↓ INSERT B2 INTO H2;
␈↓ INSERT B3 INTO H3;
␈↓ :
␈↓␈↓β4.7.6 COMPILE-TIME PREDICATE FUNCTIONS␈↓
␈↓HAL␈αprovides␈α
several␈αuseful␈αpredicate␈α
functions␈αthat␈α
are␈αevaluated␈αat␈α
compile-time.␈α One␈αof␈α
these
␈↓is
␈↓ SPECIFIED(<routine parameter>)
␈↓which␈αmay␈αbe␈αused␈αinside␈αa␈αroutine␈αto␈αtell␈αwhether␈αsome␈αparameter␈αhas␈αbeen␈αspecified␈αin␈αthe␈αcall
␈↓to the routine. (See Section 4.8). Another is
␈↓ HAS_VALUE(<variable>)
␈↓which tells whether the <variable> currently has a planning value. For instance,
␈↓ SCALAR X,Y,Z;
␈↓ COMPILE IF ␈↓ε¬␈↓HAS_VALUE(X) THEN
␈↓ BEGIN
␈↓ ASSERT X=3;
␈↓ Y←X;
␈↓ END;
␈↓ :
␈↓ COMPILE IF HAS_VALUE(X) THEN
␈↓ Z←#(X)
␈↓ ELSE
␈↓ Z←5;
␈↓would expand into
␈↓4.7.6␈α?␈α?␈α?␈α?␈α?␈α2COMPILE-TIME CONSTRUCTS␈↓
aPage 47
␈↓ SCALAR X,Y,Z;
␈↓ ASSERT X=3;
␈↓ Y←X;
␈↓ Z←3;
␈↓if X has no planning value.
␈↓␈↓β4.7.7 COMPILE-TIME VARIABLES␈↓
␈↓Compile-time␈αvariables␈αin␈αmany␈αways␈αresemble␈αmacros,␈αand␈αmay␈α(to␈αsome␈αextent)␈αbe␈αused␈αas␈αsuch.
␈↓The␈α∞principle␈α
difference␈α∞(but␈α
not␈α∞the␈α
only␈α∞difference)␈α
is␈α∞that␈α
macros␈α∞work␈α
at␈α∞the␈α
text␈α∞level␈α
(i.e.,
␈↓expand␈α⊂into␈α⊂strings␈α⊂of␈α⊂characters),␈α⊂while␈α⊂compile-time␈α⊂variables␈α⊂work␈α⊂at␈α⊂the␈α⊂token␈α⊂level.␈α⊂This
␈↓provides␈α
a␈α
number␈α
of␈α
implementation␈α
efficiencies,␈α
as␈αwell␈α
as␈α
a␈α
nice␈α
"hook"␈α
for␈α
those␈α
parts␈αof␈α
HAL,
␈↓such as the pattern matcher or library routines, that manipulate compiler constructs.
␈↓Compile-time variables are declared by the construct
␈↓ COMPILE_TIME v1,v2,...,vn;
␈↓As␈α
mentioned␈α∞earlier,␈α
they␈α∞have␈α
no␈α∞runtime␈α
existence␈α∞whatsoever.␈α
Instead,␈α∞the␈α
compiler␈α∞can␈α
set
␈↓their␈α
"planning␈α
value"␈α
to␈α
be␈α
any␈α
string␈α
of␈α
tokens␈α
in␈α
the␈α
language.␈α
Then,␈α
for␈α
compile␈αtime␈α
variable
␈↓V, the construct
␈↓ #(V)
␈↓produces␈α
the␈αsame␈α
effect␈αas␈α
if␈αthe␈α
current␈αvalue␈α
of␈αV␈α
had␈αbeen␈α
explicitly␈αincluded␈α
in␈α
the␈αsource
␈↓program.
␈↓We␈αhave␈α
already␈αdiscussed␈αone␈α
method␈α(the␈αBIND␈α
construct)␈αby␈αwhich␈α
a␈αvalue␈αmay␈α
be␈αgiven␈αto␈α
a
␈↓compile-time variable. The other common way is the assignment statement:
␈↓ <ct var> ← <ct var>
␈↓For instance,
␈↓ COMPILE_TIME A,B;
␈↓ :
␈↓ A←B;
␈↓ COMMENT this causes the planning value of A to
␈↓ be set to the current planning value of B,
␈↓ so that, now, #(A) is the same as #(B) ;
␈↓ :
␈↓HAL␈α∩also␈α∩includes␈α∩a␈α∩number␈α∩of␈α∩constructs␈α∩that␈α∩cause␈α∩the␈α∩compiler␈α∩to␈α∩invent␈α∩a␈α⊃"temporary"
␈↓compile-time␈α
variable␈α∞containing␈α
some␈α
token␈α∞string␈α
as␈α
its␈α∞value.␈α
For␈α
example,␈α∞if␈α
a␈α
body␈α∞of␈α
text
␈↓appears␈αin␈αmacro␈αdelimiters␈αin␈αan␈α"unexpected"␈αplace,␈αthat␈αis,␈αnot␈αin␈αa␈αmacro␈αdefinition␈αor␈αmacro
␈↓Page 48␈α?␈α?␈α?␈α?␈α?␈α~COMPILE-TIME CONSTRUCTS␈↓ ∂4.7.7
␈↓parameter␈αlist,␈αthen␈αthe␈αcompiler␈αscans␈αthe␈αenclosed␈αtext␈αand␈αbuilds␈αa␈αcompile-time␈αvariable␈α(with
␈↓an unprintable name) whose value is the resulting token string. Thus if we have
␈↓ COMPILE_TIME A;
␈↓ :
␈↓ A←⊂GO DIRECTLY TO JAIL⊃;
␈↓then
␈↓ #(A);
␈↓will yield
␈↓ GO DIRECTLY TO JAIL;
␈↓Note also that
␈↓ #(⊂More garbage⊃)
␈↓merely gives
␈↓ More garbage
␈↓Normally,␈α∞expansion␈α∞of␈α∞the␈α∞"planning␈α∞value"␈α∂construct␈α∞is␈α∞turned␈α∞off␈α∞while␈α∞the␈α∞delimited␈α∂text␈α∞is
␈↓being␈α
tokenized.␈α
This␈α
allows␈α
you␈α
to␈α
store␈α
things␈α
like␈α
#(var)␈α
inside␈α
a␈α
compile-time␈α
variable.␈α
For
␈↓instance,
␈↓ COMPILE_TIME FOO,BAZ;
␈↓ BAZ ← ⊂CENTER #(FOO)⊃;
␈↓ :
␈↓ FOO ← ⊂ YFINGERS ⊃;
␈↓ #(BAZ);
␈↓ :
␈↓ FOO← ⊂ BFINGERS ⊃;
␈↓ #(BAZ);
␈↓This expands into
␈↓ CENTER YFINGERS;
␈↓ :
␈↓ CENTER BFINGERS;
␈↓The construct
␈↓ EXPAND(<ct variable>)
␈↓produces␈α⊃a␈α⊃new␈α⊃compile-time␈α⊃variable␈α⊃whose␈α⊃value␈α⊃is␈α⊃the␈α⊃"evaluation"␈α⊃of␈α⊃its␈α⊃argument.␈α⊂ The
␈↓meaning of this is best shown by an example:
␈↓4.7.7␈α?␈α?␈α?␈α?␈α?␈α2COMPILE-TIME CONSTRUCTS␈↓
aPage 49
␈↓ BAZ←⊂CENTER #(FOO)⊃;
␈↓ FOO←⊂YFINGERS⊃;
␈↓ BAR←EXPAND(BAZ);
␈↓gives the same effect as
␈↓ BAR←⊂CENTER YFINGERS⊃;
␈↓One␈α∞frequent␈α∞use␈α∞of␈α
assertions␈α∞is␈α∞to␈α∞specify␈α
a␈α∞number␈α∞of␈α∞properties␈α
of␈α∞some␈α∞object␈α∞or␈α
variable.
␈↓For instance,
␈↓ ASSERT FACT(HEIGHT widget 100);
␈↓ ASSERT FACT(WEIGHT widget 200);
␈↓ ASSERT FACT(DEPROACH widget [(1,2,3)|(π,0,0)]);
␈↓These properties may be retrieved by means of a binding boolean, as in
␈↓ COMPILE IF FACT(HEIGHT widget BIND(h)) THEN
␈↓ BEGIN
␈↓ MOVE YELLOW TO widget*[(0,0,#(h)):(0,0,0)];
␈↓ :
␈↓ END;
␈↓Unfortunately,␈α
binding␈α
is␈α
frequently␈α
rather␈α
inconvenient␈α
as␈α
a␈α
means␈α
for␈α
fetching␈α
a␈α∞single␈α
value,
␈↓since␈α
it␈α
requires␈α
explicit␈α
use␈αof␈α
an␈α
auxiliary␈α
variable.␈α
In␈αsuch␈α
cases,␈α
the␈α
PICK␈α
construct␈α
can␈αbe
␈↓used instead, as in
␈↓ MOVE YELLOW TO f1
␈↓ USING WEIGHT=#(PICK(WEIGHT widget BIND(*)) );
␈↓In general, PICK has the form
␈↓ PICK(<pattern>)
␈↓where␈α⊂<pattern>␈α⊃is␈α⊂just␈α⊂like␈α⊃the␈α⊂FACT␈α⊂patterns␈α⊃discussed␈α⊂in␈α⊂previous␈α⊃sections,␈α⊂except␈α⊃that␈α⊂it
␈↓contains␈α"BIND(*)"␈αas␈αone␈αterm.␈α PICK␈αcauses␈αthe␈αcompiler␈αto␈αcreate␈αa␈αnew␈αcompile-time␈αvariable
␈↓whose␈α
value␈α
corresponds␈α
to␈α
the␈αBIND(*)␈α
term␈α
in␈α
the␈α
matched␈α
fact␈αfrom␈α
the␈α
data␈α
base.␈α
If␈αno␈α
value
␈↓is␈α⊗found␈α⊗then␈α↔a␈α⊗null␈α⊗value␈α⊗is␈α↔used.␈α⊗ Note␈α⊗that␈α⊗<pattern>␈α↔can␈α⊗also␈α⊗contain␈α↔instances␈α⊗of
␈↓ANYTHING or BIND(<variable>), as in:
␈↓ ASSERT FACT ( GADGET FITS ONTO WIDGET AT [(0,0,0):(π,0,0)]);
␈↓ :
␈↓ OBJ←PICK(GADGET FITS ONTO BIND(*) ANYTHING BIND(LOCN));
␈↓which would set the value of OBJ to "WIDGET" and the value of LOCN to "[(0,0,0):(π,0,0)]".
␈↓Another␈αoccasionally␈αuseful␈αfacility␈αis␈αthe␈αability␈αto␈αextract␈αpart␈αof␈αa␈αtoken␈αstream.␈α HAL␈αprovides
␈↓a number of "subfield" operations to perform this function. The simplest is
␈↓Page 50␈α?␈α?␈α?␈α?␈α?␈α~COMPILE-TIME CONSTRUCTS␈↓ ∂4.7.7
␈↓ <ct variable>[<index>]
␈↓which␈α
creates␈α
a␈α∞new␈α
compile-time␈α
variable␈α∞whose␈α
value␈α
is␈α
the␈α∞<index>th␈α
element␈α
of␈α∞#(<ct␈α
var>).
␈↓(The␈αexact␈αmeaning␈αof␈α"element"␈αwill␈αbe␈αdiscussed␈αin␈αa␈αmoment.␈α For␈αthe␈αpresent,␈α"token"␈αmay␈αbe
␈↓substituted.) For example:
␈↓ POEM ← ⊂ ARMA VIRUMQUE CANO, TROJAE QUI PRIMUS AB ORIS . . .⊃
␈↓ :
␈↓ B←POEM[3]; Comment: now #(B) is "CANO";
␈↓Subsequences of elements may be obtained through use of
␈↓ <ct variable>[<index> FOR <count>]
␈↓and
␈↓ <ct variable>[<lower bound> TO <upper bound>]
␈↓which do the "obvious" thing. For instance,
␈↓ B← POEM[2 TO 3]; Comment sets #(B) to "VIRUMQUE CANO";
␈↓ C← ⊂HIP BONE CONNECTED TO THE THIGH BONE⊃[1 FOR 2];
␈↓ Comment gives "HIP BONE";
␈↓Suppose we want to extract the frame constant from a construct like
␈↓ ASR ← ⊂ ASSERT YELLOW = [(0,1,2):(π,0,0)]⊃;
␈↓If␈α⊂the␈α⊂extraction␈α⊂operator␈α⊂worked␈α⊂purely␈α⊂on␈α⊂the␈α⊂token␈α⊂level,␈α⊂we'd␈α⊂have␈α⊂to␈α⊂say␈α⊂something␈α∂like
␈↓#(ASR[4␈αFOR␈α19]),␈α
which␈αsomehow␈αseems␈αa␈α
lot␈αless␈αnatural␈αthan␈α
saying␈α"ASR[4]".␈α To␈α
allow␈αfor
␈↓this,␈αthe␈αHAL␈αextraction␈αprimitives␈αtreat␈αthings␈αinside␈αpaired␈α"nesting"␈αcharacters␈α(⊂⊃,(),[],␈αand␈α{})
␈↓as␈α∪single␈α∀elements.␈α∪ Also,␈α∪the␈α∀constructs␈α∪BIND(var),␈α∪PICK(<pattern>),␈α∀FACT(<pattern>),␈α∪and
␈↓INDEX(v1,v2) are all treated as single elements. Thus
␈↓ ⊂ A B (C*3) D ⊃[3]
␈↓ ⊂ A + B * C [(X,Y,Z):(π,0,0)] ⊃[6]
␈↓ ⊂ ASSERT FACT(HUMAN TURING) ⊃[2]
␈↓ ⊂ BIND(A) PICK(HUMAN BIND(*)) ANYTHING ⊃[3]
␈↓expand to
␈↓ (C*3)
␈↓ [(X,Y,Z):(π,0,0)]
␈↓ FACT(HUMAN TURING)
␈↓ ANYTHING
␈↓The same nesting rules apply to FACTs. Thus if we have
␈↓4.7.7␈α?␈α?␈α?␈α?␈α?␈α2COMPILE-TIME CONSTRUCTS␈↓
aPage 51
␈↓ ASSERT FACT( PROPERTIES hammer ⊂WEIGHT x LOCUS (f*y) ⊃);
␈↓ :
␈↓ hprops←PICK(PROPERTIES hammer BIND(*));
␈↓then
␈↓ #(hprops) expands to ⊂WEIGHT x LOCUS (f*y) ⊃
␈↓ hprops[4] expands to (f*y)
␈↓Note that here #(hprops) still includes the "⊂ ⊃" and will hence yield a new compile-time variable.
␈↓Another␈αoccasionally␈αuseful␈αfacility␈αis␈αthe␈αability␈αto␈αdetermine␈αthe␈αindex␈αof␈αan␈αelement␈αin␈αa␈αstring
␈↓of tokens. This function is performed by the INDEX primitive:
␈↓INDEX(<ct var 1>,<ct var 2>)
␈↓which␈α
produces␈αan␈α
integer␈αconstant␈α
whose␈αvalue␈α
is␈αthe␈α
index␈αof␈α
the␈αfirst␈α
occurrence␈αof␈α
#(<ct␈αvar
␈↓1>)␈α
in␈α
#(<ct␈α∞var␈α
2>).␈α
This␈α∞function␈α
is␈α
especially␈α∞useful␈α
in␈α
extracting␈α∞properties␈α
from␈α
a␈α∞list.␈α
For
␈↓instance:
␈↓ PROPL←⊂WEIGHT 1 HEIGHT 200 LOCATION [(1,2,4):(π,0,0)]⊃;
␈↓ Comment INDEX(⊂HEIGHT⊃,PROPL) = 3 ;
␈↓ W←PROPL[1+INDEX(⊂WEIGHT⊃,PROPL)]; Comment Now #(W)=1;
␈↓␈↓∧4.8 LIBRARY ROUTINES␈↓
␈↓Many␈αof␈αthe␈αapplications␈αfor␈αwhich␈αHAL␈αis␈αintended␈αcharacteristicly␈αinvolve␈αrepeating␈αa␈αnumber
␈↓of␈αvery␈αsimilar␈αsubtasks.␈α For␈αinstance,␈αan␈αassembly␈αprogram␈αmight␈αhave␈αto␈αchange␈αsockets␈αon␈αan
␈↓electric␈α⊂driver␈α⊂many␈α⊂times␈α∂in␈α⊂order␈α⊂to␈α⊂drive␈α∂down␈α⊂a␈α⊂number␈α⊂of␈α∂different␈α⊂bolts.␈α⊂ If␈α⊂written␈α∂in
␈↓"simple"␈α∃HAL,␈α∃with␈α∃each␈α∃such␈α∃subtask␈α∃coded␈α∃out␈α∃in␈α∃explicit␈α∃statements␈α∃like␈α∃MOVE␈α∃and
␈↓OPERATE,␈α
such␈α
programs␈α
would␈α
be␈αvery␈α
tedious␈α
to␈α
write␈α
and␈αdebug.␈α
On␈α
the␈α
other␈α
hand,␈αthe
␈↓necessity␈α
of␈α
planning␈α
motions␈α
frequently␈α
makes␈α
procedures␈α
(in␈α
the␈α
traditional␈α
sense)␈α
infeasible.␈α
To
␈↓overcome␈αthis␈αdifficulty,␈αHAL␈αprovides␈αa␈α
facility␈αfor␈α"routines",␈αwhich␈αexternally␈αresemble␈α
macros,
␈↓in␈α∩that␈α∩they␈α∩are␈α∩"expanded"␈α∩each␈α∩time␈α∩they␈α∩are␈α∩invoked,␈α∩although␈α∩they␈α∩are␈α∩are␈α∩stored␈α⊃and
␈↓manipulated␈αby␈α
the␈αcompiler␈α
in␈αa␈α
somewhat␈αmore␈α
efficient␈αmanner.␈α
The␈αHAL␈α
system␈αwill␈α
include
␈↓a␈αpredefined␈αlibrary␈αof␈αroutines␈αfor␈α
performing␈αa␈αnumber␈αof␈αcommonly␈αuseful␈αfunctions,␈α
although
␈↓a user can, of course, "roll her own" by using the ROUTINE construct, which has the form
␈↓ ROUTINE <id> (<parameter list>);
␈↓ <body>
␈↓where␈αthe␈α
<parameter␈αlist>␈α
syntax␈αis␈αthe␈α
same␈αas␈α
for␈αprocedure␈αdefinitions,␈α
and␈αthe␈α
<body>␈αmay
␈↓be␈αeither␈αan␈αexpression␈αor␈αa␈αstatement.␈αWhen␈αthe␈αlibrary␈αroutine␈αis␈αexpanded,␈αall␈αinstances␈αof␈αthe
␈↓parameter␈αnames␈αare␈αsubstituted␈αwith␈αthe␈αactual␈αparameters␈αsupplied␈αin␈αthe␈αcall.␈α Thus,␈α
a␈αtypical
␈↓library routine declaration might look like:
␈↓Page 52␈α?␈α?␈α?␈α?␈α?␈α?␈α'LIBRARY ROUTINES␈↓ $4.8
␈↓ ROUTINE reach(SCALAR thickness;FRAME place);
␈↓ BEGIN
␈↓␈↓ ∧λ␈↓βCOMMENT␈α∩causes␈α⊃the␈α∩hand␈α⊃to␈α∩move␈α⊃to␈α∩the␈α⊃indicated␈α∩spot,␈α∩and␈α⊃keep
␈↓β␈↓ ∧λopening & closing its fingers until something is put in them;
␈↓ SCALAR flag;
␈↓ MOVE YELLOW TO place;
␈↓ flag←1;
␈↓ WHILE flag␈↓ε≠␈↓0 DO
␈↓ BEGIN
␈↓ OPERATE YFINGERS WITH OPENING = 5;
␈↓ OPERATE YFINGERS WITH OPENING = thickness-.1
␈↓ ON YTOUCH DO
␈↓ BEGIN
␈↓ flag←0;
␈↓ STOP;
␈↓ END;
␈↓ END;
␈↓ END
␈↓Library␈α∞routines␈α∞without␈α∞parameters␈α∞are␈α∞invoked␈α∂simply␈α∞by␈α∞including␈α∞their␈α∞name␈α∞in␈α∂the␈α∞source
␈↓program.␈α∂ For␈α∂instance,␈α∂suppose␈α∞we␈α∂have␈α∂a␈α∂library␈α∞routine␈α∂PARK_YELLOW␈α∂which␈α∂parks␈α∞the
␈↓yellow arm. Then
␈↓ IF h>3 THEN
␈↓ PARK_YELLOW
␈↓might expand into something like
␈↓ IF h>3 THEN
␈↓ MOVE YELLOW TO YPARK
␈↓There␈α∞are␈α∞several␈α∞ways␈α∞to␈α∞specify␈α∞parameters.␈α∂ Perhaps␈α∞the␈α∞simplest␈α∞is␈α∞to␈α∞follow␈α∞the␈α∂syntax␈α∞for
␈↓procedure␈αcalls,␈αin␈αwhich␈αcase␈αthe␈αarguments␈αmust␈αcorrespond␈αin␈αorder␈αand␈αtype␈αwith␈αthose␈αin␈αthe
␈↓statement which defined the routine. For example,
␈↓ reach(0.5, [(1,2,3):(π/2,π/2,0)])
␈↓This␈αcan␈αbecome␈αvery␈αinconvenient␈αfor␈αroutines␈αwhich␈αhave␈αa␈αlarge␈αnumber␈αof␈αparameters,␈αsince
␈↓the␈αuser␈αmay␈αhave␈αtrouble␈αremembering␈αthe␈αcorrect␈αorder,␈αor␈αmay␈αwant␈αto␈αleave␈αsome␈α
unspecified.
␈↓These difficulties are avoided by using the form
␈↓ reach(thickness = 0.5, place = [(1,2,3):(π/2,π/2,0)])
␈↓It is possible to specify default values for parameters to library routines by including the construct
␈↓ (DEFAULT <value>)
␈↓after the parameter name in the formal parameter list for the routine. For example,
␈↓4.8␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α⊂LIBRARY ROUTINES␈↓
aPage 53
␈↓ ROUTINE reach(FRAME arm(DEFAULT YELLOW),place;
␈↓ SCALAR thickness(DEFAULT 0));
␈↓ BEGIN
␈↓ :
␈↓ END
␈↓ :
␈↓ reach(BLUE,f1); comment a thickness of 0 is assumed;
␈↓ reach(place=f2,thickness=10); comment YELLOW arm assumed;
␈↓The construct
␈↓ SPECIFIED(<parameter id>)
␈↓may␈α
be␈αused␈α
in␈α
a␈αcompile-time␈α
conditional␈α
to␈αtest␈α
whether␈α
the␈αnamed␈α
parameter␈α
has␈αbeen␈α
assigned
␈↓a value. For example,
␈↓ ROUTINE transmogrify(COMPILE_TIME errdev;...);
␈↓ BEGIN
␈↓␈↓ ∧λ␈↓βCOMMENT␈α∩Note␈α∩here␈α∩that␈α∩the␈α∩compile-time␈α∩variable␈α∩errdev␈α∩is␈α⊃merely
␈↓β␈↓ ∧λbeing␈αused␈αas␈αa␈αname␈αpassing␈αmechanism.␈α I.e.,␈αwe␈αaren't␈α
saying␈α#(errdev)
␈↓β␈↓ ∧λanywhere. ;
␈↓ :
␈↓ IF errcond THEN
␈↓ BEGIN
␈↓ COMPILE IF SPECIFIED(errdev) THEN
␈↓ OPERATE errdev
␈↓ ELSE
␈↓ ABORT;
␈↓ END;
␈↓ :
␈↓ END;
␈↓If␈αa␈αparameter␈α
has␈αno␈αdefault␈α
value␈αspecified␈αand␈α
is␈αnot␈αbound␈α
by␈αthe␈αcall,␈α
then␈αany␈αexpansion␈α
of
␈↓the␈αroutine␈αthat␈αuses␈αthe␈αparameter␈αwill␈αresult␈αin␈αan␈αerror;␈αoccurrences␈αof␈αan␈αunbound␈αparameter
␈↓in the unexpanded part of a compile time conditional are legal.
␈↓Yet␈αanother␈αsyntax␈αis␈αacceptable␈αfor␈αinvocation␈αof␈αlibrary␈αroutines;␈αit␈αis␈αincluded␈αfor␈αcompatibility
␈↓with␈αhigh␈αlevel␈αprimitives␈α(see␈αChapter␈α5).␈α In␈αthis␈αform,␈αthe␈αparameter␈αnames␈αact␈αlike␈αkey␈αwords
␈↓identifying various clauses in a "pseudo-english" statement, as in
␈↓ REACH thickness 0.5 place [(1,2,3):(π/2,π/2,0)];
␈↓If␈αa␈αparameter␈αto␈αa␈αroutine␈αoccurs␈αin␈αthe␈αbody␈αin␈αsome␈αconstruct␈αwhere␈αa␈αvariable␈αmust␈αoccur␈α(eg.
␈↓the␈α∞left␈α
hand␈α∞side␈α∞of␈α
an␈α∞assignment␈α∞statement),␈α
the␈α∞compiler␈α
will␈α∞do␈α∞the␈α
"right"␈α∞thing␈α∞when␈α
the
␈↓corresponding␈α∞actual␈α∞parameter␈α∞is␈α∞a␈α∞constant␈α∂or␈α∞expression:␈α∞a␈α∞warning␈α∞will␈α∞be␈α∞printed,␈α∂and␈α∞the
␈↓compiler will invent a temporary variable to hold the value.
␈↓Page 54␈α?␈α?␈α?␈α?␈α?␈α?␈α'LIBRARY ROUTINES␈↓ ∂4.8.1
␈↓␈↓β4.8.1 SAVING LIBRARY ROUTINES␈↓
␈↓Library routines may be saved on a file by use of the statement (and supervisor command)
␈↓ SAVE <flag> <routine name list> ON <file specifier>
␈↓where <flag> may be either NEW, OLD, or <empty>. For instance,
␈↓ SAVE reach, transmogrify ON "FEE.FIE[FO,FUM]";
␈↓ SAVE OLD foobaz ON "DEFS.1[II,HE]";
␈↓ SAVE NEW grab1, grab2, grab3 ON "GRABS";
␈↓IF␈α
<flag>␈α
is␈α
<empty>␈αand␈α
one␈α
of␈α
the␈αnamed␈α
routines␈α
already␈α
exists␈αon␈α
the␈α
specified␈α
file,␈α
the␈αold
␈↓definition␈αis␈αoverwritten.␈αIF␈α<flag>␈αis␈αNEW,␈αthen␈αonly␈αroutines␈αwhich␈αdo␈αnot␈αalready␈αexist␈αon␈αthe
␈↓specified␈αfile␈αwill␈αbe␈αadded.␈α Similarly,␈αif␈α<flag>␈αis␈αOLD␈αthen␈αonly␈αroutines␈αwhich␈αare␈αalready␈αon
␈↓the␈α
file␈α
will␈α
be␈α
saved.␈α
If␈α
the␈α
<routine␈α
name␈α
list>␈α
is␈α
omitted,␈α
then␈α
all␈α
existing␈α
routines␈α
will␈α
be␈α
saved
␈↓on the specified file. E.g.
␈↓ SAVE ON "DEFS.ALL";
␈↓ SAVE NEW ON "DEFS.2";
␈↓Library routines may be retrieved from a file by the command
␈↓ RETRIEVE <flag> <routine name list> FROM <file specifier>
␈↓If␈α∩<flag>␈α∩is␈α∩empty,␈α∩then␈α∩the␈α∩specified␈α∪routines␈α∩will␈α∩be␈α∩retrieved␈α∩from␈α∩the␈α∩specified␈α∪file.␈α∩ If,
␈↓however,␈α∂<flag>␈α∞is␈α∂NEW,␈α∂then␈α∞only␈α∂routines␈α∂which␈α∞are␈α∂not␈α∞already␈α∂defined␈α∂will␈α∞be␈α∂read␈α∂in;␈α∞if
␈↓<flag>␈α⊃is␈α⊃OLD,␈α⊂then␈α⊃only␈α⊃routines␈α⊃which␈α⊂are␈α⊃already␈α⊃defined␈α⊃will␈α⊂be␈α⊃retrieved␈α⊃(they␈α⊃will␈α⊂be
␈↓redefined).␈α
If␈α
the␈α
<routine␈α
name␈α
list>␈α
is␈α
<empty>,␈α
then␈α
all␈α
routines␈α
on␈α
the␈α
file␈α
will␈α
be␈α
read␈α
(subject
␈↓to any restrictions imposed by <flag>). Examples:
␈↓ RETRIEVE FROM "DEFS.RCB";
␈↓ RETRIEVE Aeneas, Dido FROM "CAVE";
␈↓ RETRIEVE NEW FROM "HAL.LIB[HAL,HE]";
␈↓␈↓β4.8.2 SAVING AND RESTORING PLANNING VALUES␈↓
␈↓The␈α
statement␈αSAVE␈α
WORLD␈αON␈α
W1␈αwill␈α
cause␈αthe␈α
"world"␈αat␈α
that␈αpoint␈α
in␈αthe␈α
planning␈αto␈α
be
␈↓written␈α∞out␈α∞into␈α∞a␈α∞file␈α∞called␈α∞W1.WLD.␈α∞ The␈α∞statement␈α∞RETRIEVE␈α∞WORLD␈α∞FROM␈α∞W1␈α∞will
␈↓read␈α∞in␈α∞this␈α∞file␈α∞and␈α∞set␈α∞up␈α∞the␈α∂world␈α∞as␈α∞it␈α∞was␈α∞when␈α∞saved.␈α∞ The␈α∞world␈α∞includes␈α∂all␈α∞planning
␈↓values␈α⊃and␈α∩all␈α⊃assertions.␈α∩ It␈α⊃does␈α∩not␈α⊃include␈α⊃defined␈α∩library␈α⊃routines.␈α∩ Saving␈α⊃the␈α∩world␈α⊃is
␈↓particularly␈α
useful␈αfor␈α
recovering␈αwhen␈α
the␈α
arm␈αruns␈α
into␈αtrouble;␈α
it␈α
makes␈αit␈α
unnecessary␈αto␈α
begin
␈↓the planning from scratch.
␈↓It␈α∞is␈α
also␈α∞possible␈α∞to␈α
improve␈α∞the␈α∞planning␈α
values␈α∞of␈α∞frames␈α
after␈α∞a␈α∞period␈α
of␈α∞execution;␈α∞this␈α
is
␈↓4.8.2␈α?␈α?␈α?␈α?␈α?␈α?␈α?LIBRARY ROUTINES␈↓
aPage 55
␈↓done␈α
by␈α
the␈α
statement␈αRESTORE␈α
WORLD␈α
FROM␈α
RUNTIME.␈α
The␈αeffect␈α
of␈α
this␈α
is␈α
that␈αall␈α
the
␈↓variables␈α∞which␈α∞the␈α∞runtime␈α∞knows␈α∞about␈α∞are␈α∞read,␈α∞and␈α∞their␈α∞values␈α∞become␈α∞the␈α∂new␈α∞planning
␈↓values for those variables.
␈↓Page 56␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α ␈↓ H
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0␈↓∧CHAPTER 5␈↓
␈↓␈α?␈α?␈α:␈↓¬VERY HIGH LEVEL LANGUAGE CAPABILITIES␈↓
␈↓␈↓∧5.1 INTRODUCTION ␈↓
␈↓To␈α∂date,␈α∂manipulator␈α∂control␈α⊂languages␈α∂have␈α∂been␈α∂very␈α⊂explicit,␈α∂with␈α∂the␈α∂user␈α⊂giving␈α∂detailed
␈↓specifications␈αof␈αwhat␈αmotions␈α
are␈αto␈αbe␈αmade,␈α
what␈αsensors␈αare␈αto␈α
be␈αtested,␈αetc.␈αTo␈α
some␈αextent
␈↓this␈α∞is␈α
also␈α∞true␈α
of␈α∞HAL.␈α
One␈α∞can␈α
conceive␈α∞of␈α
programming␈α∞complicated␈α
assemblies␈α∞using␈α
only
␈↓MOVE␈α∞and␈α∞OPERATE␈α∞statements,␈α∞ON␈α∞monitors,␈α∂and␈α∞the␈α∞like.␈α∞ In␈α∞practice,␈α∞however,␈α∂such␈α∞an
␈↓approach␈α∩has␈α⊃many␈α∩disadvantages␈α∩for␈α⊃users,␈α∩who␈α⊃frequently␈α∩don't␈α∩care␈α⊃about␈α∩all␈α∩the␈α⊃details
␈↓needed␈α
to␈α
produce␈α
a␈αprogram␈α
at␈α
the␈α
manipulator␈α
level.␈α For␈α
instance,␈α
an␈α
assembly␈α
engineer␈αwho
␈↓wants to put an engine together might typically want to write something like:
␈↓ :
␈↓ FIT enginehead ONTO engineblock
␈↓ WITH ALIGNMENT stud_x IN headhole_x,
␈↓ stud_y IN headhole_y;
␈↓ INSERT bolt1 IN headhole1
␈↓ USING TOOL driver
␈↓ WITH TORQUE 10;
␈↓ INSERT bolt2 IN headhole2
␈↓ USING TOOL driver
␈↓ WITH TORQUE 10;
␈↓ INSERT drainplug IN sidehole;
␈↓ :
␈↓and allow the system to fill in the details, rather than coding up all the motions herself.
␈↓This␈α∂chapter␈α∂gives␈α∂an␈α∂overview␈α∞of␈α∂those␈α∂parts␈α∂of␈α∂HAL␈α∂that␈α∞allow␈α∂the␈α∂user␈α∂to␈α∂specify␈α∂tasks␈α∞at
␈↓somewhat␈α∪more␈α∪convenient␈α∪levels␈α∪of␈α∩abstraction␈α∪than␈α∪provided␈α∪by␈α∪the␈α∪manipulation␈α∩control
␈↓statements␈α
alone.␈α
Here,␈α
we␈α
are␈α
concerned␈α
with␈α
a␈α
"semi-automatic"␈α
programming␈α
system␈α∞that␈α
can
␈↓make␈α
a␈α
number␈α
of␈αthe␈α
specific␈α
decisions␈α
required␈αto␈α
turn␈α
an␈α
"high␈αlevel"␈α
task␈α
description␈α
into␈αa
␈↓running␈α∩program␈α∩and␈α∪which␈α∩can␈α∩ask␈α∩for␈α∪(and␈α∩accept)␈α∩help␈α∩for␈α∪those␈α∩details␈α∩that␈α∪it␈α∩cannot
␈↓determine for itself.
␈↓The␈αrange␈αof␈αdecisions␈αthat␈αthe␈αsystem␈αmay␈αhave␈αto␈αmake␈αis␈αquite␈αbroad,␈αranging␈αfrom␈αvery␈αlocal
␈↓matters,␈αsuch␈αas␈αthe␈αnumber␈αof␈αtrajectories␈αwhich␈αmust␈αbe␈αplanned␈αto␈αensure␈αcorrect␈αperformance
␈↓of␈α
all␈α
cases␈α
of␈α
some␈α
motion␈α
request,␈α
to␈α
rather␈α
global␈α
decisions,␈α
such␈α
as␈α
how␈α
an␈α
object␈α
should␈α
be
␈↓grasped,␈αhow␈α
an␈αobject␈αorientation␈α
is␈αto␈α
be␈αdetermined,␈αor␈α
what␈αshould␈αbe␈α
the␈αrelative␈α
order␈αfor
␈↓executing several related subtasks.
␈↓Some␈αof␈αthese␈αdecisions␈αare␈αessentially␈αdomain-independent.␈α For␈αexample,␈αthe␈αsystem␈αdecides␈αhow
␈↓many␈α
different␈α
arm␈α
trajectories␈αit␈α
must␈α
plan␈α
for␈α
a␈αgiven␈α
MOVE␈α
statement␈α
by␈α
examining␈αits␈α
model
␈↓5.1␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α(INTRODUCTION ␈↓
aPage 57
␈↓of␈αthe␈αlocus␈αof␈αthe␈αdestination␈αframe␈α(see␈αSection␈α5.6),␈αwithout␈αmuch␈αregard␈αfor␈αthe␈α"meaning"␈αof
␈↓the␈α∂frame␈α∞variable.␈α∂ Other␈α∞decisions␈α∂may␈α∂require␈α∞a␈α∂significant␈α∞degree␈α∂of␈α∂specialized␈α∞knowledge
␈↓about␈αthe␈αtask␈αdomain.␈α For␈αinstance,␈αthe␈αINSERT␈αprimitive␈αin␈αour␈αexample␈αwould␈αneed␈αto␈αknow
␈↓how␈α∞a␈α∞nutdriver␈α
is␈α∞used␈α∞to␈α
grasp␈α∞a␈α∞bolt,␈α∞what␈α
effects␈α∞(if␈α∞any)␈α
the␈α∞shape␈α∞of␈α
the␈α∞bolt␈α∞tip␈α∞or␈α
hole
␈↓chamfer␈αhas␈αon␈αchoice␈αof␈αsearch␈αmethod,␈αwhat␈αconstraints␈αare␈αimposed␈αon␈αworkpiece␈αpositioning,
␈↓and␈αmuch␈αmore.␈αOne␈αvery␈αimportant␈αconstraint␈αon␈αthe␈αoutput␈αprogram␈αis␈αthat␈αit␈αbe␈αconsistent,␈αin
␈↓the␈α∂sense␈α∂that␈α∂code␈α∂generated␈α∂to␈α∂accomplish␈α∂one␈α∂subtask␈α∂should␈α∂not␈α∂be␈α∂inconsistent␈α∂with␈α∂(and,
␈↓indeed,␈αshould␈αfacilitate)␈αthe␈α
accomplishment␈αof␈αother␈αsubtasks.␈α
This␈αnecessity,␈αin␈αturn,␈α
frequently
␈↓generates␈α∞further␈α∂requirements␈α∞for␈α∞specialized␈α∂knowledge␈α∞about␈α∞the␈α∂requirements␈α∞and␈α∂effects␈α∞of
␈↓the primitives being provided.
␈↓We␈α
have␈α
chosen␈αsmall␈α
scale␈α
industrial␈α
automation␈αas␈α
a␈α
good␈αdomain␈α
for␈α
investigating␈α
the␈αissues
␈↓involved␈α∞in␈α∞incorporating␈α
such␈α∞specialized␈α∞knowledge␈α
into␈α∞HAL,␈α∞and␈α
this␈α∞discussion␈α∞is␈α
oriented
␈↓accordingly.␈α⊗ However,␈α∃many␈α⊗of␈α∃the␈α⊗mechanisms␈α∃underlying␈α⊗the␈α∃various␈α⊗language␈α∃features
␈↓discussed␈αhere␈αare␈αfairly␈αgeneral;␈αan␈αexpert␈αsystem␈αfor␈αsome␈αother␈αmanipulatory␈αdomain␈αcould␈αbe
␈↓organized␈αalong␈αthe␈αsame␈αlines␈αand,␈αindeed,␈α
could␈αuse␈αat␈αleast␈αsome␈αof␈αthe␈αsame␈α
primitives.␈α The
␈↓ease␈α∂of␈α∂such␈α∂adaptation␈α∂would␈α∂depend,␈α∂of␈α∂course,␈α∞on␈α∂the␈α∂closeness␈α∂of␈α∂the␈α∂domains␈α∂and␈α∂on␈α∞the
␈↓particular primitives involved.
␈↓␈↓∧5.2 MACRO OPERATIONS AS A `HIGH LEVEL LANGUAGE'␈↓
␈↓One␈α∪obvious␈α∪partial␈α∪solution␈α∪is␈α∪to␈α∪combine␈α∪commonly␈α∪occuring␈α∪code␈α∪sequences␈α∪into␈α∪"macro
␈↓operations",␈αand␈αthen␈α
allow␈αthe␈αuser␈αto␈α
specify␈αtasks␈αin␈αterms␈α
of␈αthose␈αoperations.␈α
HAL␈αincludes
␈↓sophisticated␈α∂macro,␈α∂defined␈α∂routine,␈α∂and␈α∂conditional␈α∂compilation␈α∂facilities␈α∂(see␈α∂Section␈α∂4.7␈α∂and
␈↓Section␈α
4.8)␈α
for␈α
this␈α
purpose.␈α
Such␈α
library␈α
routines␈α
have␈α
the␈α
advantage␈α
of␈α
being␈α
relatively␈α
easy
␈↓for␈α∂a␈α∂person␈α∂familiar␈α∞with␈α∂HAL␈α∂to␈α∂write,␈α∂and␈α∞are␈α∂generally␈α∂at␈α∂least␈α∂partially␈α∞self-documenting.
␈↓Typically,␈α⊂a␈α⊂user␈α⊂wishing␈α⊂to␈α⊂know␈α⊂what␈α⊂a␈α⊂given␈α⊂library␈α⊂routine␈α⊂does␈α⊂can␈α⊂find␈α⊂out␈α⊂merely␈α∂by
␈↓looking␈αat␈αa␈αlisting␈αof␈αthe␈α
routine,␈αwhich␈αwill␈α(of␈αcourse)␈αbe␈α
written␈αin␈αa␈αclear,␈αwell␈αstructured␈α
style
␈↓with␈α∂many␈α∂comments␈α∂describing␈α∂the␈α∂more␈α∞obscure␈α∂passages.␈α∂ Generally,␈α∂such␈α∂libraries␈α∂are␈α∞most
␈↓useful␈α∞where␈α∞there␈α∞is␈α∞essentially␈α
only␈α∞one␈α∞way␈α∞to␈α∞do␈α∞a␈α
given␈α∞subtask,␈α∞all␈α∞actions␈α∞required␈α∞to␈α
do
␈↓each␈α∞subtask␈α∞can␈α∞be␈α∞performed␈α∞at␈α∞one␈α∞place␈α∞in␈α∞the␈α∞output␈α∞program,␈α∞and␈α∞different␈α∞subtasks␈α∞are
␈↓essentially␈α∞independent.␈α∞When␈α∞these␈α∞conditions␈α∞are␈α∞not␈α∞fully␈α∞met,␈α∞more␈α∞powerful␈α∞techniques␈α∞are
␈↓needed.
␈↓␈↓∧5.3 MORE POWERFUL PRIMITIVES -- AN OVERVIEW␈↓
␈↓Many␈α↔domains␈α↔are␈α↔sufficiently␈α↔complicated␈α_that␈α↔macro␈α↔expansion,␈α↔even␈α↔when␈α_used␈α↔with
␈↓conditional␈αcompilation,␈αis␈α
too␈αlimited.␈α In␈αassembly,␈α
there␈αmay␈αbe␈αa␈α
number␈αof␈αdifferent␈α
ways␈αto
␈↓do␈α
some␈α
particular␈α
task;␈α
which␈αway␈α
is␈α
"right"␈α
depends␈α
very␈αlargely␈α
on␈α
what␈α
other␈α
subtasks␈αmust␈α
be
␈↓done.␈α∂Similarly,␈α∂it␈α∂is␈α∂frequently␈α∂possible␈α∂to␈α∂perform␈α∞part␈α∂of␈α∂one␈α∂subtask␈α∂(or,␈α∂at␈α∂least,␈α∂to␈α∞gather
␈↓Page 58␈α?␈α?␈α?␈α?␈α?␈α>HIGH-LEVEL PRIMITIVES␈↓ $5.3
␈↓useful␈α
information)␈αin␈α
the␈αcourse␈α
of␈αdoing␈α
another␈αone.␈α
Such␈αconsiderations␈α
are␈αin␈α
general␈αvery
␈↓difficult to express within the paradigm of macro expansion.
␈↓In␈α
our␈α
introductory␈α
example,␈α
for␈α
instance,␈α
the␈α
system␈αmust␈α
decide␈α
how␈α
the␈α
engine␈α
block␈α
is␈α
to␈αbe
␈↓oriented␈αto␈α
facilitate␈αputting␈αon␈α
the␈αhead.␈α
Furthermore,␈αthe␈αblock␈α
alignment␈αmust␈α
be␈αsufficiently
␈↓well␈α
determined␈αso␈α
that␈α
the␈αthe␈α
aligning␈αstuds␈α
can␈α
find␈αtheir␈α
way␈αinto␈α
the␈α
holes.␈αOne␈α
way␈α
to␈αdo
␈↓this␈αmight␈αbe␈αto␈αpush␈α
the␈αengine␈αblock␈αup␈αagainst␈αa␈α
simple␈αaligning␈αjig␈αconsisting␈αof␈αa␈α
low␈αwall.
␈↓Other␈αmethods␈αmight␈αinclude␈αvision␈αor␈αsimply␈α
grasping␈αkey␈αfeatures␈αof␈αthe␈αblock␈αand␈αreading␈α
the
␈↓hand␈α∂coordinates.␈α∂ Once␈α∂the␈α∂head␈α∂is␈α∂on,␈α∞the␈α∂system␈α∂must␈α∂insert␈α∂the␈α∂bolts␈α∂and␈α∂drainplug.␈α∞ The
␈↓system␈αwould␈αlike␈αto␈αavoid␈αmoving␈αthe␈αengine␈αblock␈αaround␈αmore␈αthan␈αit␈αhas␈αto,␈αsince␈αeach␈αmove
␈↓requires␈αtime␈αand␈αmay␈αintroduce␈αuncertainties.␈α This␈αmeans␈αthat␈αit␈αshould␈αchoose␈αa␈αblock␈αposition
␈↓that␈αallows␈αthe␈αarm␈αto␈αreach␈αthe␈αbolt␈αand␈αdrain␈αholes.␈α If␈αan␈αaligning␈αjig␈αis␈αin␈αuse,␈αcare␈αshould␈αbe
␈↓taken␈α∞to␈α∞keep␈α∞the␈α∞side␈α∞hole␈α∞free␈α
if␈α∞possible,␈α∞and␈α∞so␈α∞forth.␈α∞Furthermore,␈α∞an␈α∞alignment␈α
technique
␈↓that␈α
visually␈α
locates␈α
the␈α
engine␈α
block␈α
head␈α
holes␈α
is␈α
apt␈α
to␈α
yield␈α
more␈α
useful␈α
information␈α∞for␈α
the
␈↓insertion␈αtasks␈α
than␈αwould␈α
some␈αcruder,␈α
but␈αless␈αexpensive,␈α
test␈αwhich␈α
may␈αwork␈α
just␈αas␈α
well␈αfor
␈↓the purpose of mating the head.
␈↓A␈α
full␈α
discussion␈α
of␈α
the␈α
mechanisms␈α
used␈α∞by␈α
the␈α
system␈α
to␈α
transform␈α
a␈α
high␈α
level␈α∞program␈α
into
␈↓one␈αthat␈α
can␈αactually␈α
run␈αis␈α
beyond␈αthe␈αscope␈α
of␈αthis␈α
paper.␈α Briefly,␈α
HAL␈αworks␈α
by␈αprogressive
␈↓refinement␈αof␈αthe␈αuser's␈αprogram␈αspecifications,␈αand␈αuses␈αprocess␈αinstantiation␈αand␈αcommunication
␈↓mechanisms␈α∞to␈α∞keep␈α
track␈α∞of␈α∞the␈α∞various␈α
subtasks␈α∞and␈α∞to␈α∞ensure␈α
that␈α∞all␈α∞decisions␈α∞are␈α
mutually
␈↓compatible.␈α Knowledge␈αabout␈αassembly␈αprimitives␈αis␈αencoded␈αinto␈αa␈αnumber␈αof␈αprocedures␈αinside
␈↓the␈α
expander.␈α
With␈α
each␈αprogram␈α
statement,␈α
the␈α
system␈αassociates␈α
a␈α
process␈α
instantiation␈α
of␈αthe
␈↓appropriate␈α∂procedure␈α∞(of␈α∂course,␈α∞the␈α∂processes␈α∞for␈α∂low-level␈α∞HAL␈α∂statements␈α∞are␈α∂fairly␈α∞trivial).
␈↓These␈α∃processes␈α∀are␈α∃then␈α∀arranged␈α∃into␈α∀a␈α∃prerequisite␈α∀graph␈α∃based␈α∀initially␈α∃on␈α∃the␈α∀user's
␈↓specification␈α∪of␈α∩what␈α∪must␈α∪be␈α∩done␈α∪before␈α∪what␈α∩(see␈α∪subsection␈α∪4.2.3).␈α∩ A␈α∪number␈α∪of␈α∩other
␈↓"bureaucrat"␈α⊃processes␈α⊃are␈α⊃created␈α⊃to␈α∩work␈α⊃out␈α⊃compromises,␈α⊃invent␈α⊃new␈α⊃service␈α∩tasks,␈α⊃decide
␈↓relative␈α⊂ordering,␈α⊂watch␈α⊂out␈α⊂for␈α⊂obvious␈α⊂inefficiencies␈α⊂(such␈α⊂as␈α⊂putting␈α⊂down␈α⊂a␈α⊂tool␈α⊂and␈α∂then
␈↓picking␈αit␈αright␈αback␈αup␈αagain),␈αand␈αso␈α
on.␈α As␈αthe␈αplan␈αbecomes␈αmore␈αdetailed,␈αand␈α
as␈αdecisions
␈↓are␈α
made␈α
about␈αthe␈α
order␈α
in␈αwhich␈α
subtasks␈α
are␈αto␈α
be␈α
performed,␈αsuccessive␈α
copies␈α
of␈αthe␈α
program
␈↓graph␈αare␈αgenerated.␈α (Additional␈αinformation␈αis␈αstored␈αboth␈αin␈αthe␈αdata␈αbase␈αand␈αin␈αthe␈αinternal
␈↓state␈α∂of␈α∂the␈α∞various␈α∂subtask␈α∂processes.)␈α∞The␈α∂final␈α∂phase␈α∞is␈α∂to␈α∂run␈α∞down␈α∂the␈α∂(linearized)␈α∞graph,
␈↓asking each subtask process to generate the appropriate output code.
␈↓␈↓∧5.4 CALLING HIGH LEVEL PRIMITIVES␈↓
␈↓The␈α⊂syntax␈α⊂for␈α⊂high␈α∂level␈α⊂primitives␈α⊂is␈α⊂keyword-oriented␈α∂and␈α⊂resembles␈α⊂that␈α⊂for␈α⊂MOVE␈α∂and
␈↓OPERATE␈α∩statements␈α∩in␈α∩the␈α∩sense␈α∩that␈α∩there␈α∩is␈α∩a␈α∩main␈α∩clause␈α∩naming␈α∩the␈α∩operation,␈α⊃with
␈↓possibly␈α
a␈α
number␈α∞of␈α
subordinate␈α
clauses␈α
giving␈α∞further␈α
specifications␈α
as␈α
to␈α∞what␈α
is␈α
to␈α∞be␈α
done.
␈↓For example,
␈↓ INSERT screw1 INTO hole1 {main clause}
␈↓ USING TOOL nutdriver {subordinate clause}
␈↓ WITH TORQUE = 10 {subordinate clause}
␈↓5.4␈α?␈α?␈α?␈α?␈α?␈α→CALLING HIGH LEVEL PRIMITIVES␈↓
aPage 59
␈↓For␈α∞convenience␈α∞and␈α∞readability,␈α∞a␈α∞number␈α
of␈α∞different␈α∞forms␈α∞are␈α∞acceptable.␈α∞ For␈α∞instance,␈α
the
␈↓words␈α∪"WITH"␈α∪and␈α∩"USING"␈α∪are␈α∪interchangeable,␈α∩and␈α∪punctuation␈α∪(like␈α∩the␈α∪"=",␈α∪above)␈α∩is
␈↓frequently␈αoptional.␈α Some␈αof␈αthe␈αsubordinate␈αclauses␈αmay␈αthemselves␈αcontain␈αseveral␈αelements,␈αas
␈↓in
␈↓ FIT carburator ONTO engine_assembly_1
␈↓ WITH ALIGNMENT
␈↓ carburator_hole1 OVER stud1,
␈↓ carburator_hole2 OVER stud2;
␈↓In such cases, a comma is used to delimit successive elements.
␈↓Initially,␈αonly␈αa␈αfairly␈αsmall␈αset␈αof␈αhigh␈αlevel␈αprimitives␈αis␈αbeing␈αimplemented,␈αalthough␈αsome␈α(like
␈↓INSERT)␈α∞may␈α∞be␈α∞quite␈α∞flexible.␈α∞ Even␈α∞a␈α∞few␈α∞primitives,␈α∞however,␈α∞turn␈α∞out␈α∞to␈α∞be␈α∞sufficient␈α
for
␈↓many␈α
interesting␈αtasks,␈α
and␈αprovide␈α
quite␈αa␈α
rich␈α
environment␈αfor␈α
investigation␈αof␈α
how␈αthe␈α
various
␈↓parts of the system interact.
␈↓Probably␈αthe␈αmost␈αelaborate␈αprimitive␈αis␈αINSERT,␈αwhich␈αis␈αgenerally␈αresponsible␈αfor␈αinsertion␈αof
␈↓shafts and shaft-like objects (including screws) into holes. The main clause is
␈↓ INSERT <shaft-specification> INTO <hole-specification>
␈↓where␈α
the␈α<shaft-specification>␈α
should␈αbe␈α
either␈α
an␈αobject␈α
of␈αtype␈α
shaft␈α
or␈αone␈α
end␈αof␈α
an␈αobject␈α
of
␈↓type␈αshaft.␈α In␈αthe␈αformer␈αcase,␈αthe␈αsystem␈α
will␈αassume␈αthat␈αthe␈α"bottom␈αend"␈αof␈αthe␈αspecified␈α
shaft
␈↓should␈α
be␈α
inserted␈αinto␈α
the␈α
named␈α
hole.␈α(See␈α
Section␈α
5.7)␈αSimilarly,␈α
the␈α
<hole␈α
specification>␈αmay
␈↓be␈αeither␈αthe␈αname␈αof␈αa␈αhole␈αor␈αof␈αa␈αbore,␈αin␈αwhich␈αcase␈αthe␈αtop␈αend␈αwill␈αbe␈αassumed.␈α HAL␈αcan
␈↓learn␈α
a␈α∞good␈α
part␈α∞of␈α
exactly␈α
what␈α∞it␈α
is␈α∞being␈α
asked␈α∞to␈α
do␈α
by␈α∞looking␈α
at␈α∞the␈α
object␈α∞models.␈α
For
␈↓instance,␈α
if␈α
the␈α
shaft␈α
and␈α
bore␈α
are␈α
both␈α
threaded␈α
and␈α
have␈α
the␈α
same␈α
diameter,␈α
then␈α
the␈α
system␈α
will
␈↓attempt␈αto␈αscrew␈αin␈αthe␈αshaft␈αproperly.␈α Similarly,␈αby␈αlooking␈αat␈αthe␈αchamfer␈αof␈αthe␈αhole,␈αthe␈αtaper
␈↓of␈α
the␈α
shaft,␈α
and␈α
the␈α
region␈α
around␈α∞the␈α
hole,␈α
the␈α
system␈α
can␈α
decide␈α
how␈α
much␈α∞determination␈α
is
␈↓required,␈αwhat␈αsort␈αof␈αsearch␈αmight␈αbe␈αapplicable,␈αetc.␈α Further␈αspecifications␈αmay␈αbe␈αincluded␈αin
␈↓subordinate␈αclauses,␈αsuch␈αas␈αthe␈αTOOL␈αand␈αTORQUE␈αclauses␈αin␈αour␈αfirst␈αexample,␈αor␈αas␈αin␈αthe
␈↓TWIST clause of
␈↓ INSERT aligning_pin INTO guide_hole
␈↓ WITH TWIST = 3
␈↓which␈αsays␈αthat␈αthe␈αpin␈αis␈αto␈αbe␈αgiven␈αthree␈αturns␈αcounter-clockwise␈αas␈αit␈αis␈αpushed␈αinto␈αthe␈αguide
␈↓hole.␈α⊂ Additional␈α∂"advice"␈α⊂may␈α⊂also␈α∂be␈α⊂provided␈α⊂in␈α∂the␈α⊂data␈α∂base.␈α⊂ For␈α⊂instance,␈α∂if␈α⊂there␈α⊂is␈α∂a
␈↓special␈αroutine␈αfor␈αgrasping␈α"type␈α1"␈αscrews␈αwith␈αthe␈αnutdriver,␈αthere␈αmight␈αbe␈αan␈αassertion␈αof␈αthe
␈↓form:
␈↓ FACT ( GRASPING_METHOD screwtype1 nutdriver routineid )
␈↓(This␈α∞example␈α
rather␈α∞oversimplifies␈α∞the␈α
actual␈α∞mechanism␈α∞used␈α
to␈α∞describe␈α∞this␈α
sort␈α∞of␈α∞thing;␈α
a
␈↓fuller description, however, is beyond the scope of this paper.)
␈↓Another fairly elaborate primitive is
␈↓ FIT <object1> ONTO <object2>
␈↓Page 60␈α?␈α?␈α?␈α?␈α0CALLING HIGH LEVEL PRIMITIVES␈↓ $5.4
␈↓where␈α⊂<object1>␈α⊂is␈α⊂usually␈α⊂a␈α⊂subpart␈α⊂of␈α⊂assembly␈α⊂<object2>.␈α⊂(See␈α⊂Section␈α⊂5.7␈α⊂for␈α⊂more␈α∂details
␈↓about␈α
assemblies.)␈α
If␈α
this␈α
is␈α
not␈α
the␈α
case,␈α
then␈α
the␈α
attachment␈α
location␈α
must␈α
be␈α
specified␈α
by␈α
a␈α
clause
␈↓of the form
␈↓ AT <transform>
␈↓The most common modifying clause for this primitive is an alignment specification, such as
␈↓ WITH ALIGNMENT
␈↓ <hole> OVER <shaft>,
␈↓ <obj 1 feature> MEETS <obj 2 feature>,
␈↓ <shaft> INTO <hole>,
␈↓ { et cetera }
␈↓Other primitives include:
␈↓ SLIP <collar> OVER <shaft> {includes nut over threaded shaft}
␈↓ PLACE <object> ON <surface>
␈↓ IN POSITION <stable position> {optional}
␈↓ GRASP <object> AT <trans or frame>
␈↓ TIGHTEN <bolt or nut>
␈↓ WITH TORQUE <number> {this clause is required}
␈↓ EXTRACT <shaft> {the inverse of INSERT}
␈↓␈↓∧5.5 WORLD MODELLING OVERVIEW␈↓
␈↓The␈α
planning␈α
information␈α
required␈α
by␈α
the␈α
very␈αhigh␈α
level␈α
primitives␈α
is␈α
essentially␈α
a␈α
superset␈αof
␈↓that␈αrequired␈αfor␈αthe␈αbasic␈αmanipulation␈αcontrol␈αstatements;␈αthe␈αsame␈αunderlying␈αmechanisms␈αare
␈↓used,␈α∂although␈α∂sometimes␈α⊂in␈α∂slightly␈α∂different␈α∂ways.␈α⊂ This␈α∂includes␈α∂information␈α⊂about␈α∂variable
␈↓semantics,␈αobject␈α
shape␈αand␈α
structure,␈αerror␈α
estimates,␈αand␈α
the␈αpurposes␈α
of␈αprograms,␈α
in␈αaddition
␈↓to the simple planning values and attachment structures used for low-level trajectory planning.
␈↓The␈α
expander␈αfrequently␈α
needs␈αto␈α
consider␈αthe␈α
effects␈αof␈α
some␈αhypothetical␈α
action␈αon␈α
a␈αnumber␈α
of
␈↓program␈α∞steps.␈α∞ Similarly,␈α∞it␈α∞is␈α∞often␈α∂necessary␈α∞to␈α∞consider␈α∞the␈α∞effects␈α∞of␈α∞modifying␈α∂some␈α∞earlier
␈↓decision␈α∞or␈α∂to␈α∞find␈α∂a␈α∞way␈α∂to␈α∞perform␈α∂some␈α∞preparatory␈α∂action␈α∞at␈α∂an␈α∞early␈α∂point␈α∞in␈α∂a␈α∞program.
␈↓HAL␈α∞handles␈α∞provides␈α∞for␈α∞this␈α∞sort␈α∞of␈α∂consideration␈α∞by␈α∞the␈α∞use␈α∞of␈α∞a␈α∞simple␈α∂"multi-world"␈α∞data
␈↓base.␈α∞ Essentially,␈α∞all␈α
fluent␈α∞information␈α∞(such␈α
as␈α∞planning␈α∞values␈α
of␈α∞variables,␈α∞assertions,␈α∞etc)␈α
is
␈↓associated␈αwith␈α
a␈αset␈α
of␈α"world"␈α
states␈αfor␈αwhich␈α
it␈αis␈α
true.␈α With␈α
every␈αprogram␈α
statement,␈αHAL
␈↓5.5␈α?␈α?␈α?␈α?␈α?␈α)WORLD MODELLING OVERVIEW␈↓
aPage 61
␈↓then␈α⊂associates␈α⊂an␈α⊂"input␈α⊂world",␈α⊂which␈α⊂contains␈α⊂the␈α⊂planning␈α⊂model␈α⊂of␈α⊂the␈α⊂environment␈α⊂just
␈↓before␈α
the␈αstatement␈α
gets␈α
executed,␈αand␈α
an␈α
"output␈αworld"␈α
which␈α
will␈αreflect␈α
the␈α
expected␈αeffects␈α
of
␈↓the␈α
statement␈α
on␈αthe␈α
runtime␈α
world.␈α
Normally,␈αthese␈α
two␈α
"worlds"␈α
can␈αbe␈α
the␈α
same␈α
when␈αonly␈α
low-
␈↓level␈α
HAL␈α
statements␈αare␈α
involved,␈α
since␈αsuch␈α
statements␈α
don't␈αusually␈α
need␈α
to␈α
generate␈αforward
␈↓or backward references to other planning states.
␈↓Although␈α⊃multiple␈α⊃worlds␈α⊃are␈α⊃primarily␈α⊃intended␈α∩for␈α⊃use␈α⊃by␈α⊃the␈α⊃expander,␈α⊃a␈α⊃user␈α∩can␈α⊃make
␈↓explicit references to different worlds by using
␈↓ IN <worldname>
␈↓in␈αASSERT␈α
and␈αDENY␈αstatements␈α
and␈αin␈αthe␈α
various␈αCOMPILE␈αconstructs.␈α
The␈αcompile-time
␈↓variables␈α
IWORLD␈α
and␈αOWORLD␈α
always␈α
contain␈αHAL's␈α
internal␈α
names␈αfor␈α
the␈α
current␈αinput
␈↓and output worlds, respectively. For example,
␈↓ ASSERT s=1;
␈↓ w←IWORLD;
␈↓ :
␈↓ COMPILE IF (s=1) IN #(w) THEN
␈↓ ASSERT s=2;
␈↓ Comment, now #(s)=2;
␈↓Note: IN acts syntactically like a very high priority boolean binary operator, so that
␈↓ #(a)=1 IN #(w1) ␈↓ε∨␈↓ #(b)=1 ∧ #(a)=2 IN #(w2)
␈↓is equivalent to
␈↓ (#(a)=1 IN #(w1)) ␈↓ε∨␈↓ ((#(b)=1 IN #(IWORLD) ∧ (#(a)=2 IN #(w2))
␈↓␈↓∧5.6 INFORMATION ABOUT VARIABLES␈↓
␈↓The␈α⊃system␈α∩must␈α⊃deal␈α∩with␈α⊃a␈α∩number␈α⊃of␈α⊃different␈α∩sorts␈α⊃of␈α∩information␈α⊃about␈α∩variables␈α⊃and
␈↓variable values. These include:
␈↓␈↓ αH(1)␈↓β␈αMetaphysical␈αvalue.␈↓␈α
The␈αmetaphysical␈αvalue␈αof␈α
a␈αvariable␈αis␈α
that␈αquantity
␈↓␈↓ αHwhich␈α
the␈α∞variable␈α
is␈α
supposed␈α∞to␈α
represent.␈α
Traditionally,␈α∞knowledge␈α
about
␈↓␈↓ αHthe␈αmeaning␈αof␈αvariables␈αhas␈αbeen␈α
more␈αor␈αless␈αthe␈αexclusive␈αprovince␈α
of␈αthe
␈↓␈↓ αHprogrammer.␈α∂ For␈α∞example,␈α∂low␈α∂level␈α∞HAL␈α∂constructs␈α∞don't␈α∂usually␈α∂know␈α∞or
␈↓␈↓ αHcare␈α∂what␈α∂some␈α∂user-declared␈α⊂frame␈α∂variable␈α∂really␈α∂represents,␈α⊂although␈α∂the
␈↓␈↓ αHsystem␈α∂does␈α∂understand␈α∂a␈α⊂few␈α∂predeclared␈α∂variables␈α∂(e.g.,␈α⊂YELLOW,␈α∂which
␈↓␈↓ αHgives␈αthe␈αlocation␈αof␈αthe␈αyellow␈αarm).␈α On␈αthe␈αother␈αhand,␈αa␈αstatement␈αlike␈α"fit
␈↓␈↓ αHthe␈α∀pumphead␈α∀onto␈α∀the␈α∃pump␈α∀assembly"␈α∀requires␈α∀HAL␈α∀to␈α∃"know"␈α∀what
␈↓␈↓ αHvariables␈α
represent␈α∞object␈α
locations,␈α
mateing␈α∞position,␈α
grasping␈α∞positions,␈α
and
␈↓␈↓ αHso forth.
␈↓Page 62␈α?␈α?␈α?␈α?␈α/INFORMATION ABOUT VARIABLES␈↓ $5.6
␈↓␈↓ αH(2)␈↓β␈α∞Runtime␈α
Value.␈↓␈α∞This␈α∞is␈α
the␈α∞value␈α∞that␈α
a␈α∞given␈α∞variable␈α
will␈α∞have␈α∞at␈α
run
␈↓␈↓ αHtime.␈α The␈αcompiler␈αhas␈αa␈αname␈αfor␈αit,␈αand␈αmust␈αgenerate␈αcode␈αthat␈αreferences
␈↓␈↓ αHthe corresponding memory location(s).
␈↓␈↓ αH(3)␈↓β␈α
Locus␈α
information.␈↓␈αCrudely␈α
put,␈α
the␈αlocus␈α
of␈α
a␈α
variable␈αis␈α
the␈α
set␈αof␈α
possible
␈↓␈↓ αHruntime␈α⊂values␈α⊃for␈α⊂that␈α⊂variable.␈α⊃The␈α⊂term␈α⊃is␈α⊂also␈α⊂used␈α⊃here␈α⊂to␈α⊃mean␈α⊂the
␈↓␈↓ αHcompiler's␈α∂estimate␈α∂of␈α∂the␈α∂locus.␈α∞ This␈α∂estimate␈α∂may␈α∂merely␈α∂be␈α∂the␈α∞planning
␈↓␈↓ αHvalue,␈α∞or␈α
it␈α∞may␈α
include␈α∞a␈α
region␈α∞bounded␈α
by␈α∞constraints.␈α∞ These␈α
constraints
␈↓␈↓ αHmay␈α⊂be␈α⊂expressed␈α⊂explicitly,␈α⊂as␈α⊂mathematical␈α⊂relations␈α⊂involving␈α⊃degrees␈α⊂of
␈↓␈↓ αHfreedom,␈α∞or␈α∞implicitly,␈α∞as␈α∞semantic␈α∞information␈α∞like␈α∞"the␈α∞object␈α∞is␈α∞up␈α
against
␈↓␈↓ αHthe wall."
␈↓␈↓ αH(4)␈↓β␈αDetermination␈αinformation.␈↓␈αThe␈αdetermination␈αof␈αa␈αvariable␈αis␈αessentially␈αa
␈↓␈↓ αHcompile-time␈α∀estimate␈α∀of␈α∀how␈α∃accurately␈α∀a␈α∀runtime␈α∀value␈α∀will␈α∃reflect␈α∀the
␈↓␈↓ αHcorresponding␈αmetaphysical␈αvalue.␈α As␈αwith␈αthe␈αlocus,␈αthis␈αinformation␈αmay␈α
be
␈↓␈↓ αHexpressed in a number of ways.
␈↓For␈α
example,␈α
suppose␈α
we␈α
we␈α
want␈α
to␈α
compile␈α
code␈α
to␈α
pick␈α
up␈α
an␈α
object␈α
which␈α
we␈α
know␈α
will␈α
be
␈↓sitting upright on the table. This might be reflected by the assertion
␈↓ ASSERT FACT (obj ON_SURFACE TABLE upright)
␈↓where␈α⊃"obj"␈α⊃is␈α⊃a␈α⊃variable␈α⊃giving␈α⊃the␈α∩location␈α⊃of␈α⊃the␈α⊃object,␈α⊃and␈α⊃"upright"␈α⊃has␈α∩been␈α⊃defined
␈↓somewhere␈αas,␈αsay,␈α[(0,0,0):(0,0,0)].␈α This␈αpiece␈αof␈αsemantic␈αinformation␈αwould␈αbe␈αtranslated␈αby␈αthe
␈↓system into assertions about the locus of obj:
␈↓ ASSERT FACT (LOCUS obj ([(x,y,0)|(0,0,theta)]*upright) )
␈↓ ASSERT x ␈↓ε≥␈↓ 0; ASSERT x≤10; {suppose table is 10 by 10}
␈↓ ASSERT y ␈↓ε≥␈↓ 0; ASSERT y≤10;
␈↓The␈α∂system␈α∂can␈α∂handle␈α∂linear␈α∂constraints␈α∂on␈α∂degrees␈α∂of␈α∂freedom␈α∂(in␈α∂this␈α∂case,␈α∂x,␈α∂y,␈α∂and␈α∂theta)
␈↓within␈α
locus␈α
expressions.␈α For␈α
instance,␈α
suppose␈α
that␈αwe␈α
also␈α
know␈α
that␈αthe␈α
object␈α
is␈αsomewhere␈α
on
␈↓a strip running diagonally across the table. This might translate into
␈↓ ASSERT x+y≤15;
␈↓ ASSERT x+y␈↓ε≥␈↓7;
␈↓so that the object locus is now given by
␈↓ [(x,y,0)|(0,0,theta)]*upright ␈↓
[[Eq. 5.1]
␈↓ 0≤x≤10
␈↓ 0≤y≤10
␈↓ 7≤x+y≤15
␈↓ -π≤theta≤π
␈↓Suppose␈αthat␈αwe␈αnow␈αcall␈αa␈αvision␈αroutine␈αto␈αlocate␈αthe␈αobject␈αto␈αwithin␈αone␈αcentimeter␈αand␈αthree
␈↓degrees. The vision routine will store some value, say
␈↓5.6␈α?␈α?␈α?␈α?␈α?␈α_INFORMATION ABOUT VARIABLES␈↓
aPage 63
␈↓ [(3,7,0):(0,0,2.5)]
␈↓into␈α⊂the␈α⊂value␈α⊂cell␈α⊂for␈α⊃obj.␈α⊂ We␈α⊂clearly␈α⊂cannot␈α⊂know␈α⊂in␈α⊃advance␈α⊂that␈α⊂this␈α⊂will␈α⊂be␈α⊃that␈α⊂value
␈↓returned,␈αso␈α
the␈αlocus␈αestimate␈α
given␈αby␈α
Equation␈α5.1␈αwill␈α
remain␈αunchanged.␈α
On␈αthe␈αother␈α
hand,
␈↓the␈αdetermination␈αof␈αobj␈αhas␈αbeen␈αimproved␈αto␈αthe␈αpoint␈αwhere␈αthe␈αobject␈αcan␈αbe␈αpicked␈αup.␈α In
␈↓other words, if we execute the statement
␈↓ MOVE YELLOW TO obj*objgrasp
␈↓then␈α
we␈α∞know␈α
that␈α∞the␈α
yellow␈α
arm␈α∞will␈α
wind␈α∞up␈α
pretty␈α
close␈α∞to␈α
its␈α∞nominal␈α
relative␈α∞position␈α
for
␈↓grasping␈αthe␈αobject.␈α In␈αplanning␈αa␈αtrajectory␈αto␈αdo␈αthis,␈αthe␈αsystem␈αwill␈αuse␈αits␈αnominal␈αvalue␈αfor
␈↓obj, which (in the absence of any better advice) will be chosen at the center of the locus,
␈↓ [(5,5,0):(0,0,0)]
␈↓and then modified at runtime in the usual way.
␈↓This␈αtrajectory␈α
modification␈αmay␈αcause␈α
problems␈αif␈αthe␈α
runtime␈αvalue␈α
of␈αobj␈αgets␈α
too␈αfar␈αfrom␈α
the
␈↓nominal␈α⊂value.␈α⊃To␈α⊂avoid␈α⊃this,␈α⊂the␈α⊃expander␈α⊂will␈α⊂ask␈α⊃the␈α⊂trajectory␈α⊃calculator␈α⊂to␈α⊃evaluate␈α⊂the
␈↓suitability␈αof␈αits␈αtrajectory␈αfor␈αextreme␈αpoints␈αof␈αthe␈αlocus␈αof␈αobj.␈α If␈αthe␈αmodification␈αseems␈αto␈αbe
␈↓too␈α⊂great,␈α⊂then␈α⊂the␈α⊂expander␈α∂will␈α⊂ask␈α⊂for␈α⊂several␈α⊂trajectories␈α∂to␈α⊂be␈α⊂planned␈α⊂and␈α⊂will␈α∂generate
␈↓conditional␈α∂tests␈α∂to␈α∂select␈α⊂the␈α∂correct␈α∂one.␈α∂We␈α∂are␈α⊂currently␈α∂investigating␈α∂ways␈α∂to␈α⊂facilitate␈α∂this
␈↓communication␈α⊃between␈α⊃the␈α⊃expander␈α⊃and␈α∩the␈α⊃trajectory␈α⊃calculator.␈α⊃One␈α⊃very␈α∩simple,␈α⊃though
␈↓painstaking,␈α
method␈α
is␈α
to␈α
simulate␈α
moves␈α
to␈α
a␈α∞number␈α
of␈α
spots.␈α
A␈α
better␈α
way␈α
would␈α
be␈α∞for␈α
the
␈↓trajectory␈αcalculator␈αto␈αgenerate␈αconstraints␈αtelling␈αwhat␈αregions␈α
a␈αtrajectory␈αis␈αgood␈αfor,␈αbut␈αit␈αis␈α
a
␈↓bit␈α
too␈α∞early␈α
yet␈α
to␈α∞tell␈α
how␈α
feasible␈α∞this␈α
will␈α
be.␈α∞ Similarly,␈α
we␈α
are␈α∞investigating␈α
ways␈α∞for␈α
using
␈↓runtime errors to determine when splitting of a region may be needed.
␈↓␈↓∧5.7 OBJECT DESCRIPTION␈↓
␈↓This␈α∞section␈α∞is␈α∞intended␈α∂to␈α∞provide␈α∞an␈α∞overview␈α∞of␈α∂the␈α∞sorts␈α∞of␈α∞information␈α∞about␈α∂objects␈α∞that
␈↓HAL␈αuses␈αand␈αof␈αhow␈αthis␈αinformation␈αis␈αcurrently␈αspecified.␈α It␈αis␈αnot␈αintended␈αto␈αbe␈αa␈αcomplete
␈↓list of ␈↓βall␈↓ the assertions currently used or as a user's manual for building object descriptions.
␈↓Our␈α∂primary␈α∂interest␈α∂so␈α∂far␈α∂has␈α∂been␈α∂to␈α∂investigate␈α∂ways␈α∂to␈α∂use␈α∂descriptive␈α∂information␈α∞about
␈↓objects,␈αrather␈αthan␈αto␈αprovide␈αan␈αextremely␈αelegant␈αinput␈αlanguage␈αfor␈αthe␈αdescriptions.␈αThis␈αhas
␈↓led␈α
us␈α
to␈α
specify␈α
explicitly␈α
a␈α
number␈α
of␈α
things␈α
which␈α
are,␈α
in␈α
principle,␈α
computable␈α
from␈α∞a␈α
more
␈↓general␈α
shape␈α
description.␈α
We␈α
expect␈α
that␈α
the␈α∞process␈α
of␈α
describing␈α
an␈α
object␈α
to␈α
HAL,␈α∞which␈α
is
␈↓currently␈α
almost␈α
completely␈α
manual,␈α
will␈α
eventually␈α
become␈α
very␈α
largely␈α
automated,␈α
with␈α
most␈αof
␈↓the␈α
information␈α∞being␈α
either␈α
directly␈α∞available␈α
or␈α
computed␈α∞from␈α
the␈α
output␈α∞of␈α
computer-aided-
␈↓design programs.
␈↓Currently,␈αobjects␈αare␈αdescribed␈αby␈αassertions␈αabout␈αtheir␈α"interesting"␈αproperties.␈αThese␈αassertions
␈↓follow␈α
a␈αnumber␈α
of␈αconventions,␈α
so␈αthat␈α
the␈αvarious␈α
high␈αlevel␈α
primitives␈αcan␈α
use␈αthe␈α
information,
␈↓Page 64␈α?␈α?␈α?␈α?␈α?␈α?␈α∪OBJECT DESCRIPTION␈↓ $5.7
␈↓although␈αa␈αuser␈αcan,␈αof␈αcourse␈αmanipulate␈αit␈αexplicitly.␈α Shape␈αis␈αtreated␈αsimply␈αas␈αanother␈αobject
␈↓attribute, and a several different shape descriptions may be present for a given object.
␈↓␈↓β5.7.1 ONE-PIECE OBJECTS␈↓
␈↓Objects␈α⊃are␈α∩represented␈α⊃as␈α∩tree-like␈α⊃structures;␈α∩typically,␈α⊃the␈α∩"root"␈α⊃node␈α∩contains␈α⊃information
␈↓about␈αthe␈α
object␈αas␈αa␈α
whole,␈αwith␈α
"leaf"␈αnodes␈αtelling␈α
about␈αinteresting␈α
features.␈αBy␈αconvention,␈α
we
␈↓use␈α⊂a␈α⊂frame␈α⊂variable␈α⊂for␈α⊂the␈α⊂object␈α⊂name.␈α⊂(This␈α⊂variable␈α⊂is␈α⊂then␈α⊂assumed␈α⊂to␈α⊂give␈α⊃the␈α⊂object
␈↓location).
␈↓For example,
␈↓␈↓ αHFRAME valvebody,bore1,bore2,bore3;
␈↓␈↓ αHFRAME upright,upside_down;
␈↓␈↓ αHPLANE topsurface;
␈↓␈↓ αHASSERT FACT(TYPE valvebody OBJECT);
␈↓␈↓ αHASSERT FACT(GEOMED valvebody "valve.b3d");
␈↓␈↓ αHASSERT FACT(SUBPART valvebody bore1);
␈↓␈↓ αHASSERT FACT(SUBPART valvebody bore2);
␈↓␈↓ αHASSERT FACT(SUBPART valvebody bore3);
␈↓␈↓ αHASSERT FACT(SURFACE valvebody topsurface );
␈↓␈↓ αHASSERT FACT(STABLE_POSITION valvebody upright);
␈↓␈↓ αHASSERT FACT(STABLE_POSITION valvebody upside_down);
␈↓␈↓ αHupright ← [(0,0,0):(0,0,0)];
␈↓␈↓ αHupside_down ← [(0,0,1.8):(0,0,0)];
␈↓␈↓ αHtopsurface <= (valvebody*(0,0,1.8)) \ (Z WRT valvebody);
␈↓␈↓ αHATTACH bore1 TO valvebody AT [(-1,0,2)|(0,0,0)] RIGIDLY;
␈↓␈↓ αHATTACH bore2 TO valvebody AT [(1,0,2)|(0,0,0)] RIGIDLY;
␈↓␈↓ αHATTACH bore3 TO valvebody AT [(1,0,3)|(0,0,0)] RIGIDLY;
␈↓declares␈α
that␈α
"valvebody"␈α
is␈α
an␈α
object␈αwhose␈α
GEOMED␈α
description␈α
is␈α
given␈α
by␈α
file␈α"valve.b3d".
␈↓There␈α∃are␈α∀three␈α∃interesting␈α∀"subparts",␈α∃called␈α∃"bore1",␈α∀"bore2",␈α∃and␈α∀"bore3"␈α∃and␈α∃located␈α∀at
␈↓[(-1,0,2)|(0,0,0)],␈α∩[(1,0,2)|(0,0,0)],␈α⊃and␈α∩[(1,0,3)|(0,0,0)],␈α⊃respectively.␈α∩ Also,␈α⊃there␈α∩is␈α⊃a␈α∩planar␈α⊃surface
␈↓called␈α"topsurface"␈αlocated␈α
at␈α(0,0,1.8)\Z␈αin␈α
body␈αcoordinates.␈α The␈αvalvebody␈α
can␈αsit␈αon␈α
the␈αtable
␈↓in two "stable positions", upright and upside_down. Then, the assertion
␈↓ ASSERT FACT(valvebody ON_SURFACE table upside_down)
␈↓tells the system that the location of the valve body will be given by an expression of the form:
␈↓ [(x,y,0)|(0,0,theta)]*upside_down
␈↓for some values of x,y, and theta.
␈↓5.7.1␈α?␈α?␈α?␈α?␈α?␈α?␈α+OBJECT DESCRIPTION␈↓
aPage 65
␈↓The subparts, "bore1", "bore2", and "bore3" are further described by assertions of the form:
␈↓␈↓ αHASSERT FACT(TYPE bore1 BORE);
␈↓␈↓ αHASSERT FACT(DIAMETER bore1 0.9);
␈↓␈↓ αHASSERT FACT(THREAD bore1 8 32);
␈↓␈↓ αHASSERT FACT(LENGTH bore1 0.30);
␈↓␈↓ αHASSERT FACT(TOP_END bore1 hole1);
␈↓␈↓ αHASSERT FACT(BOTTOM_END bore1 OPEN);
␈↓␈↓ αHASSERT FACT(TYPE hole1 HOLE);
␈↓␈↓ αHASSERT FACT(LIES_IN hole1 topsurface);
␈↓␈↓ αHASSERT FACT(CHAMFER_DEPTH hole1 0);
␈↓␈↓ αHASSERT FACT(CHAMFER_WIDTH hole1 0);
␈↓␈↓ αHASSERT FACT(LIP_SIZE hole1 (3/16));
␈↓␈↓ αH { et cetera }
␈↓Here␈αthe␈αsystem␈αrecognizes␈αthe␈αword␈α"BORE"␈αas␈αsaying␈αthat␈αbore1␈αis␈αa␈αnegative␈αcylinder␈α(such␈αas
␈↓might␈α
result␈αfrom␈α
a␈α
drilling␈αoperation).␈α
The␈α
attributes␈αDIAMETER,␈α
THREAD,␈α
and␈αLENGTH
␈↓are␈α∞obvious.␈α∞ TOP_END␈α∞and␈α∞BOTTOM_END,␈α∞however,␈α∞may␈α∞require␈α∞a␈α∞bit␈α∂more␈α∞explanation.
␈↓The␈α
"top␈α∞end"␈α
of␈α∞a␈α
bore␈α
is␈α∞always␈α
a␈α∞hole␈α
--␈α∞ie,␈α
an␈α
intersection␈α∞between␈α
the␈α∞bore␈α
and␈α∞the␈α
object
␈↓surface.␈α∂ If␈α∞the␈α∂bore␈α∞completely␈α∂pierces␈α∂the␈α∞object,␈α∂then␈α∞the␈α∂bottom␈α∂end␈α∞will␈α∂be␈α∞also␈α∂be␈α∂a␈α∞hole.
␈↓Otherwise,␈α
it␈α∞may␈α
be␈α
"OPEN"␈α∞(which␈α
means␈α
that␈α∞it␈α
opens␈α
into␈α∞some␈α
uninteresting␈α∞cavity␈α
inside
␈↓the␈αobject,␈α
"CLOSED"␈α(which␈α
means␈αthat␈α
it␈αcomes␈α
to␈αan␈α
abrupt,␈αbut␈α
otherwise␈αuninteresting,␈α
end),
␈↓or a named surface (which usually only happens for relatively large holes). see Figure 5.1
␈↓Frequently,␈α∞a␈α∞user␈α∞wishes␈α∞to␈α
declare␈α∞a␈α∞number␈α∞of␈α∞instances␈α
of␈α∞a␈α∞single␈α∞prototype.␈α∞ This␈α∞may␈α
be
␈↓done by making assertions of the form.
␈↓ ASSERT FACT(TYPE <object> <prototype>);
␈↓For instance,
␈↓ ASSERT FACT(TYPE s1 screwtype1);
␈↓ ASSERT FACT(TYPE s2 screwtype1);
␈↓would declare s1 and s2 to be instances of screwtype1, where screwtype1 might be specified by
␈↓ ASSERT FACT(TYPE screwtype1 SHAFT);
␈↓ ASSERT FACT(DIAMETER screwtype1 0.62);
␈↓ ASSERT FACT(LENGTH screwtype1 2.44);
␈↓ ASSERT FACT(THREAD screwtype1 3 16);
␈↓ ASSERT FACT(TOP_END screwtype1 headtype1);
␈↓ ASSERT FACT(BOTTOM_END screwtype1 tiptype1);
␈↓ ASSERT FACT(TYPE headtype1 CYL_HEAD);
␈↓ ASSERT FACT(SLOT headtype1 HEX 0.53);
␈↓ ASSERT FACT(TYPE tiptype1 FLAT_END);
␈↓Page 66␈α?␈α?␈α?␈α?␈α?␈α?␈α∪OBJECT DESCRIPTION␈↓ ∂5.7.1
␈↓Note␈α∂that␈α∂shafts␈α∂also␈α∂are␈α⊂considered␈α∂to␈α∂be␈α∂directed␈α∂and␈α⊂to␈α∂have␈α∂two␈α∂ends.␈α∂ By␈α⊂convention,␈α∂all
␈↓screws, bolts, or similar objects are assumed to have their heads at the "top" end. see Figure 5.2
␈↓␈↓β5.7.2 ASSEMBLIES␈↓
␈↓An "assembly" is an object whose various subparts are removable.
␈↓For instance,
␈↓ ASSERT FACT(TYPE waterpump ASSEMBLY);
␈↓ ASSERT FACT(SUBPART waterpump gasket);
␈↓ ASSERT FACT(SUBPART waterpump head);
␈↓ ASSERT FACT(SUBPART waterpump pumpbase);
␈↓ :
␈↓ ASSERT FACT(gasket FITS ONTO waterpump AT [(0,0,3):(0,0,0)])
␈↓ :
␈↓Such␈α
objects␈α
provide␈α
a␈α
convenient␈α
framework␈α
for␈α
assembly␈α
tasks.␈α
Typically,␈α
one␈α
of␈α
the␈α
subparts␈α
is
␈↓chosen as a "base part", which is used as an anchor to which the remaining parts are added.
␈↓In␈α⊃addition␈α⊃to␈α⊃the␈α⊃usual␈α⊃sorts␈α⊃of␈α⊂object␈α⊃attributes␈α⊃and␈α⊃the␈α⊃locations␈α⊃of␈α⊃the␈α⊃various␈α⊂subparts,
␈↓assemblies␈αusually␈αcontain␈αa␈αnumber␈αof␈α"semantic"␈αassertions␈αabout␈αhow␈αthings␈αgo␈αtogether.␈α Some
␈↓of this information is inherent in the design. For instance,
␈↓ ASSERT FACT(DESIGNED_TORQUE screw1 40)
␈↓Other␈α∀information␈α∀comes␈α∀from␈α∀the␈α∀geometry␈α∀of␈α∀the␈α∀parts,␈α∀and␈α∀(as␈α∀indicated␈α∀earlier)␈α∪could
␈↓theoretically␈α∩be␈α∩computed␈α⊃from␈α∩the␈α∩shape␈α∩description␈α⊃but␈α∩is␈α∩of␈α⊃enough␈α∩interest␈α∩to␈α∩be␈α⊃worth
␈↓representing␈α∪directly,␈α∪especially␈α∪in␈α∪cases␈α∪where␈α∪the␈α∪computation␈α∪required␈α∪is␈α∀non-trivial.␈α∪ For
␈↓example,
␈↓ :
␈↓ ASSERT FACT(MATED pumpbase.top_surf gasket.bottom_surf)
␈↓ ASSERT FACT(ALIGNED head.bore1 gasket.bore1 pumpbase.bore1)
␈↓ ASSERT FACT(RUNS_THRU s1 gasket.bore1;
␈↓ ASSERT FACT(RUNS_THRU s1 head.bore1);
␈↓ ASSERT FACT(SCREWED_INTO s1 pumpbase.bore1);
␈↓ :
␈↓5.7.2␈α?␈α?␈α?␈α?␈α?␈α?␈α+OBJECT DESCRIPTION␈↓
aPage 67
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβFigure 5.1
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α≥Bores and Holes
␈↓Page 68␈α?␈α?␈α?␈α?␈α?␈α?␈α∪OBJECT DESCRIPTION␈↓ ∂5.7.2
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβFigure 5.2
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α Shafts
␈↓5.7.2␈α?␈α?␈α?␈α?␈α?␈α?␈α+OBJECT DESCRIPTION␈↓
aPage 69
␈↓␈↓∧5.8 EXAMPLE: WATERPUMP ASSEMBLY PROGRAM␈↓
␈↓This␈αshort␈αexample␈α
is␈αintended␈αto␈αgive␈α
some␈αfeel␈αfor␈α
what␈αa␈αvery␈αhigh␈α
level␈αprogram␈αfor␈αa␈α
simple
␈↓task looks like.
␈↓The␈αtask␈αhere␈αis␈αto␈αmate␈αthe␈αpump␈αhead␈αand␈αgasket␈αwith␈αthe␈αpump␈αbase␈αusing␈αtwo␈αaligning␈αpins,
␈↓then␈αto␈αsecure␈αthe␈αhead␈αwith␈αsix␈αmachine␈αscrews.␈α This␈αtask␈αrequires␈αonly␈αa␈αfew␈αbasic␈αoperations,
␈↓the␈α∪principle␈α∩ones␈α∪being␈α∩FIT␈α∪...␈α∩ONTO␈α∪and␈α∩INSERT,␈α∪and␈α∩is␈α∪very␈α∩similar␈α∪to␈α∪one␈α∩actually
␈↓performed␈αby␈αWAVE␈αat␈αStanford.␈α The␈αWAVE␈αprogram␈αfor␈αthis␈αtask␈αconsists␈αof␈αabout␈α450␈αlines
␈↓of␈α
"machine␈α
language"-like␈α∞code,␈α
and␈α
was␈α
written␈α∞over␈α
a␈α
period␈α
of␈α∞several␈α
weeks␈α
by␈α∞Bob␈α
Bolles
␈↓and␈α∞Lou␈α∂Paul.␈α∞(Most␈α∞of␈α∂this␈α∞time␈α∞was␈α∂spent␈α∞on␈α∞improving␈α∂WAVE␈α∞and␈α∂developing␈α∞techniques;
␈↓more␈αrecent␈αtasks␈αof␈αsimilar␈αcomplexity␈αhave␈αtaken␈αon␈αthe␈αorder␈αof␈αthree␈αto␈αeight␈αdays)␈αThe␈αsame
␈↓program,␈α
rewritten␈α
in␈αlow-level␈α
HAL,␈α
would␈αbe␈α
somewhat␈α
shorter,␈α
although␈αit␈α
would␈α
still␈αrequire␈α
a
␈↓fair amount of detailed effort on the part of the programmer.
␈↓BEGIN "PUMP"
␈↓{ Note that the characters "{ }" are comment delimiters }
␈↓REQUIRE "PUMP.075" SOURCE_FILE;
␈↓␈↓ αλ␈↓β{␈α
This␈α
file␈α
would␈αcontain␈α
many␈α
assertions␈α
describing␈α
the␈αpump␈α
assembly␈α
and␈α
all␈α
its␈αsubparts.
␈↓β␈↓ αλEventually,␈α⊂such␈α⊂descriptions␈α⊂will␈α⊂most␈α⊂likely␈α⊃be␈α⊂produced␈α⊂as␈α⊂part␈α⊂of␈α⊂the␈α⊂output␈α⊃of␈α⊂design
␈↓β␈↓ αλautomation␈α⊂programs.␈α⊂ See␈α⊂the␈α⊂section␈α⊂on␈α⊂object␈α⊂descriptions␈α⊂for␈α⊂a␈α⊂sampling␈α⊂of␈α⊂the␈α⊂sorts␈α⊂of
␈↓β␈↓ αλthings one might see here }
␈↓REQUIRE "STATN.04" SOURCE_FILE;
␈↓␈↓ αλ␈↓β{␈αReads␈αin␈αdescription␈αof␈αthe␈αwork␈αstation.␈αThis␈αwould␈αinclude␈αlocation␈αof␈αtool␈α
racks,␈αstandard
␈↓β␈↓ αλ"jigs" that may be available, etc. }
␈↓ASSERT FACT( pumpbase ON_SURFACE conveyor_belt IN POSITION upright);
␈↓␈↓ αλ␈↓β{␈αThis␈αassertion␈αtells␈αthe␈αstrategist␈αthe␈αinitial␈αlocation␈α&␈α"stable␈αposition"␈α(ie␈α"upright")␈αof␈αthe
␈↓β␈↓ αλpumpbase.␈α
The␈α∞meaning␈α
of␈α
"upright"␈α∞is␈α
given␈α
by␈α∞an␈α
assertion␈α
of␈α∞the␈α
form:␈α∞ASSERT␈α
FACT
␈↓β␈↓ αλ(STABLE_POSITION pumpbase upright [(0,0,0):(0,0,0)]);
␈↓β␈↓ αλwhich is assumed to be part of the file "PUMP.075".
␈↓β␈↓ αλThe␈αdynamic␈αframe␈α"conveyor_belt"␈αis␈αassumed␈αto␈αhave␈αbeen␈αdefined␈αin␈α"STATN.04".␈α Actually,
␈↓β␈↓ αλsuch␈α∞moving␈α∞devices␈α∞won't␈α∞be␈α∞handled␈α∞by␈α∞early␈α∞versions␈α∞of␈α∞HAL.␈α∞ An␈α∞alternative␈α∞would␈α∞be␈α∞to
␈↓β␈↓ αλarrange␈α∞the␈α∞pumpbases␈α∞in␈α∞an␈α∂array␈α∞to␈α∞one␈α∞side␈α∞of␈α∂the␈α∞work␈α∞station␈α∞(perhaps␈α∞using␈α∂an␈α∞"egg
␈↓β␈↓ αλcarton" arrangement to make it easier to pick one out). }
␈↓ASSERT FACT( pumphead ON_SURFACE side_table IN POSITION onside);
␈↓ { < a number of other assertions might go here> }
␈↓Page 70␈α?␈α?␈α?␈α?␈α?␈α?␈αβWATERPUMP ASSEMBLY␈↓ $5.8
␈↓␈↓ αλ␈↓β{␈αHere,␈αwe␈αwill␈αuse␈αTASK␈αBEGINs␈αand␈αallow␈αthe␈αsystem␈αto␈αdecide␈αon␈αthe␈αrelative␈αorder␈αof␈αthe
␈↓β␈↓ αλvarious subtasks. }
␈↓TASK BEGIN "aligning pins"
␈↓ INSERT pin1 INTO pumpbase.hole1;
␈↓ INSERT pin1 INTO pumpbase.hole2;
␈↓ END;
␈↓␈↓ βλ␈↓β{␈αNote␈αhere␈αthat␈αwe␈αare␈αallowing␈αthe␈αsystem␈αto␈αdecide␈αhow␈αit␈αwill␈αlocate␈αthe␈α
pumpbase
␈↓β␈↓ βλand␈αwhether␈αit␈α
will␈αleave␈αit␈α
on␈αthe␈αconveyor␈α
belt␈αthroughout␈αthe␈α
assembly␈αor␈αplace␈αit␈α
in
␈↓β␈↓ βλsome␈α
temporary␈αwork␈α
area.␈α Of␈α
course,␈αwe␈α
could␈αhave␈α
made␈αthese␈α
decisions␈αexplicitly.
␈↓β␈↓ βλFor instance,
␈↓␈↓ αλ PLACE pumpbase ON TABLE
␈↓␈↓ αλ IN POSITION upright
␈↓␈↓ αλ WITH ALIGNMENT left_side AGAINST wall1,
␈↓␈↓ αλ back_end AGAINST wall2;
␈↓␈↓ βλ␈↓βcould have been the first statement of the program.
␈↓β␈↓ βλ"wall1"␈α&␈α"wall2"␈α
are␈αlow␈αwalls␈α
described␈αin␈α"STATN.04"␈α
and␈αform␈αa␈α
corner␈αwhich
␈↓β␈↓ βλcould␈α∞be␈α∂used␈α∞as␈α∞a␈α∂simple␈α∞jig.␈α∞ "left_side"␈α∂&␈α∞"back_end"␈α∞here␈α∂would␈α∞be␈α∂defined␈α∞in
␈↓β␈↓ βλ"PUMP.075"␈αas␈αcomponents␈αin␈αthe␈α
"footprint"␈αof␈αthe␈αpumpbase.␈α (see␈αthe␈α
section␈αon
␈↓β␈↓ βλobject description for further details) }
␈↓FIT gasket ONTO pumpbase_assembly
␈↓ WITH ALIGNMENT gasket.hole1 OVER pin1,
␈↓ gasket.hole2 OVER pin2;
␈↓␈↓ βλ␈↓β{␈αThe␈αsystem␈αuses␈αits␈αobject␈αmodel␈αfor␈αthe␈αpumpbase␈αassembly␈αto␈αtell␈αit␈αhow␈αthe␈α
gasket
␈↓β␈↓ βλfits onto the pumpbase }
␈↓FIT pumphead ONTO pumpbase_assembly
␈↓ WITH ALIGNMENT head.hole1 OVER pin1,
␈↓ head.hole2 OVER pin2;
␈↓TASK BEGIN "boltdown"
␈↓ BEGIN "s3op"
␈↓ INSERT s3 INTO head.hole3
␈↓ WITH TOOL driver1,
␈↓ WITH TORQUE hand_tight;
␈↓ END;
␈↓5.8␈α?␈α?␈α?␈α?␈α?␈α?␈α+WATERPUMP ASSEMBLY␈↓
aPage 71
␈↓ BEGIN "s4op"
␈↓ INSERT s4 INTO head.hole4
␈↓ WITH TOOL driver1,
␈↓ WITH TORQUE hand_tight;
␈↓ END;
␈↓ BEGIN "s5op"
␈↓ INSERT s5 INTO head.hole5
␈↓ WITH TOOL driver1,
␈↓ WITH TORQUE hand_tight;
␈↓ END;
␈↓ BEGIN "s6op"
␈↓ INSERT s6 INTO head.hole6
␈↓ WITH TOOL driver1,
␈↓ WITH TORQUE hand_tight;
␈↓ END;
␈↓ BEGIN "pull_pin1"
␈↓ PREREQUISITE "s3op";
␈↓ INSERT pin1 INTO rack.hole1;
␈↓␈↓ βλ␈↓β{␈α
Once␈α
we␈α
have␈α
s3␈αin␈α
h3,␈α
then␈α
we␈α
can␈α
remove␈αpin1␈α
without␈α
fear␈α
of␈α
letting␈α
the␈αhead
␈↓β␈↓ βλslip out of alignment, since pin2 will stay until there is a screw in hole 4.}
␈↓ END;
␈↓ BEGIN "pull_pin2"
␈↓ PREREQUISITE "s4op";
␈↓ INSERT pin2 INTO rack.hole2;
␈↓ END;
␈↓ BEGIN "s1op"
␈↓ PREREQUISITE "pull_pin1";
␈↓ INSERT s1 INTO head.hole1
␈↓ WITH TOOL driver1,
␈↓ WITH TORQUE hand_tight;
␈↓ END;
␈↓ BEGIN "s2op"
␈↓ PREREQUISITE "pull_pin1";
␈↓ INSERT s2 INTO head.hole2
␈↓ WITH TOOL driver1,
␈↓ WITH TORQUE hand_tight;
␈↓ END;
␈↓ END;
␈↓Page 72␈α?␈α?␈α?␈α?␈α?␈α?␈αβWATERPUMP ASSEMBLY␈↓ $5.8
␈↓TASK BEGIN "torque head"
␈↓ COMPILE FOREACH FACT( SUBPART pump_assembly BIND(s) )
␈↓ COMPILE IF FACT(TYPE #(s) screwtype1)
␈↓ ∧ FACT(#(s) designed_torque BIND(t))) THEN
␈↓ TIGHTEN #(s) WITH TORQUE #(t)
␈↓ WITH TOOL driver1;
␈↓ END;
␈↓␈↓ βλ␈↓β{␈αThis␈αwill␈αtighten␈αall␈αsubparts␈αof␈αthe␈αpump␈αassembly␈αwhich␈αare␈αof␈αtype␈α"screwtype1"
␈↓β␈↓ βλand have a specified design torque. It might expand into something like:
␈↓␈↓ αH TASK BEGIN "torque head"
␈↓␈↓ αH TIGHTEN s1 WITH TORQUE t1 WITH TOOL driver1;
␈↓␈↓ αH TIGHTEN s2 WITH TORQUE t2 WITH TOOL driver1;
␈↓␈↓ αH :
␈↓␈↓ αH TIGHTEN s6 WITH TORQUE t6 WITH TOOL driver1;
␈↓␈↓ αH END;
␈↓␈↓ αH }
␈↓PLACE pump_assembly ON conveyor_belt IN POSITION upright;
␈↓␈↓ αλ␈↓β{␈αThis␈αwill␈αcause␈αthe␈αsystem␈αto␈αpick␈αan␈αorientation␈αfor␈αthe␈αcompleted␈αpump␈αassembly␈α&␈α
put␈αit
␈↓β␈↓ αλon␈αthe␈αconveyor.␈α
The␈αsystem␈αcan,␈α
of␈αcourse,␈α"remember"␈α
the␈αposition␈αit␈α
picks.␈α If␈αthere␈αwere␈α
some
␈↓β␈↓ αλfurther task to be done on the pump, the system will know where to find it. }
␈↓END;
␈↓5.8␈α?␈α?␈α?␈α?␈α?␈α?␈α+WATERPUMP ASSEMBLY␈↓
aPage 73
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβFigure 5.3
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α,Pump Assembly Station
␈↓Page 74␈α?␈α?␈α?␈α?␈α?␈α?␈αβWATERPUMP ASSEMBLY␈↓ $5.8
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0␈↓∧CHAPTER 6␈↓
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α/␈↓¬RUNTIME OVERVIEW␈↓
␈↓The␈αruntime␈αis␈αa␈αset␈α
of␈αprograms␈αresiding␈αin␈αthe␈α
PDP-11.␈αWe␈αwill␈αdiscuss␈αcontrol␈α
structures␈αand
␈↓data structures.
␈↓␈↓∧6.1 CONTROL STRUCTURES␈↓
␈↓There are several types of processes any number of which can be active at any time:
␈↓ 1) Interpreters
␈↓ 2) Joint servos
␈↓ 3) On-monitors
␈↓An␈α_INTERPRETER␈α_is␈α→a␈α_process␈α_which␈α_is␈α→executing␈α_arithmetic␈α_or␈α→other␈α_stack-oriented
␈↓instructions,␈α∞not␈α∞one␈α∞of␈α∞the␈α∞moves.␈α∂Most␈α∞straightforward␈α∞HAL␈α∞code␈α∞is␈α∞executed␈α∂by␈α∞interpreters.
␈↓During␈α∞execution␈α∂of␈α∞COBEGIN␈α∂blocks,␈α∞or␈α∂while␈α∞the␈α∂conclusion␈α∞of␈α∂an␈α∞ON-monitor␈α∂is␈α∞running,
␈↓there can be more than one interpreter.
␈↓Each␈αactive␈αinterpreter␈αhas␈αa␈αstack␈αon␈αwhich␈αit␈αplaces␈αoperands,␈αa␈αprogram␈αcounter␈αwhich␈αpoints
␈↓to␈α
its␈α
particular␈α
block␈α
of␈α
code,␈α
and␈α
a␈α
list␈α
of␈α
those␈α
on-monitors␈α
for␈α
which␈α
it␈α
is␈α
responsible.␈α Each
␈↓interpreter␈α
also␈αhas␈α
a␈α
reserved␈αcell␈α
in␈α
which␈αit␈α
stores␈α
information␈αconcerning␈α
its␈α
current␈αlocation␈α
in
␈↓the␈α
source␈α
code;␈α
this␈α
is␈α
useful␈α
for␈α
debugging.␈α
The␈α
code␈α
which␈α
it␈α
interprets␈α∞includes␈α
instructions
␈↓for␈α∩stack␈α∩manipulation,␈α∩arithmetic␈α∩operations,␈α∩instantiation␈α∩of␈α∩subsidiary␈α∩interpreters,␈α∩flow␈α⊃of
␈↓program␈α⊂control,␈α⊂and␈α⊂preparation␈α⊂for␈α⊂motions.␈α⊂ As␈α⊂soon␈α⊂as␈α⊂a␈α⊂move␈α⊂is␈α⊂encountered,␈α⊃the␈α⊂active
␈↓interpreter␈αinstantiates␈αthe␈αrequired␈αjoint␈αservos␈α
and␈αon-monitors␈αand␈αwaits␈αfor␈αthe␈αtermination␈α
of
␈↓the move before continuing.
␈↓A␈α
JOINT␈α
SERVO␈α
is␈α
a␈α
process␈αwhose␈α
task␈α
is␈α
to␈α
servo␈α
one␈αjoint␈α
of␈α
a␈α
moving␈α
arm,␈α
according␈αto␈α
the
␈↓planned␈αtrajectory␈αfor␈αthat␈αjoint.␈α
When␈αfinished,␈αthe␈αservo␈αstops␈α
the␈αjoint␈αand␈αdisappears.␈α If␈α
the
␈↓joint␈α⊃should␈α⊃be␈α⊃stopped␈α∩by␈α⊃some␈α⊃other␈α⊃process,␈α⊃the␈α∩servo␈α⊃cleans␈α⊃up␈α⊃the␈α⊃mess␈α∩and␈α⊃dismisses.
␈↓During␈α∞its␈α∞life,␈α∂the␈α∞servo␈α∞is␈α∂in␈α∞charge␈α∞of␈α∞applying␈α∂to␈α∞one␈α∞motor␈α∂the␈α∞correct␈α∞current,␈α∂which␈α∞will
␈↓change␈αover␈αtime.␈α The␈αcorrect␈αsignal␈αis␈αcalculated␈αbased␈αon␈αthe␈αplanned␈αlocation␈αof␈αthe␈αjoint,␈αits
␈↓observed␈α
location␈α
and␈α
velocity,␈α
and␈α
its␈αrecent␈α
positional␈α
error.␈α
After␈α
emitting␈α
the␈α
proper␈αdrive,␈α
the
␈↓servo␈α
precalculates␈α
as␈αmuch␈α
as␈α
it␈αcan␈α
for␈α
some␈α
future␈αtime,␈α
when␈α
it␈αwill␈α
again␈α
modify␈α
the␈αdrive,
␈↓and then waits for that future time to arrive.
␈↓An␈α
ON-MONITOR␈αis␈α
a␈α
process␈αwhich␈α
continually␈αchecks␈α
for␈α
some␈αcondition.␈α
If␈α
that␈αcondition
␈↓should␈αappear,␈αthen␈αthose␈αactions␈αspecified␈αby␈αthe␈αcompiler␈αas␈αcritical␈αare␈αdone␈αimmediately␈α(in␈αa
␈↓non-interruptible␈αfashion);␈αfor␈αthe␈αrest,␈αthe␈αmonitor␈αsprouts␈αan␈αinterpreter.␈α The␈α
ON-monitor␈αcan
␈↓be␈αin␈αtwo␈αstates:␈αenabled␈α
and␈αdisabled.␈α The␈αchecking␈αis␈α
only␈αdone␈αwhile␈αthe␈αmonitor␈α
is␈αenabled.
␈↓A␈αmonitor␈αdisappears␈αonly␈αwhen␈αthe␈αsystem␈αkills␈αit.␈α An␈αenabled␈αon-monitor␈αcan␈αbe␈αof␈α
two␈αtypes:
␈↓hardware␈α⊂or␈α⊂software.␈α⊂The␈α⊃hardware␈α⊂type␈α⊂is␈α⊂a␈α⊂true␈α⊃interrupt␈α⊂handler␈α⊂that␈α⊂can␈α⊂react␈α⊃to␈α⊂some
␈↓6.1␈α?␈α?␈α?␈α?␈α?␈α?␈α,CONTROL STRUCTURES␈↓
aPage 75
␈↓hardware␈αcondition.␈α An␈αexample␈αof␈αthis␈αis␈αa␈αmonitor␈αto␈αdetect␈αsomething␈αhitting␈αthe␈α
touch␈αpads
␈↓on␈αthe␈αfingers.␈α The␈αsoftware␈αtype␈αis␈αa␈αset␈αof␈αcalculations␈αwhich␈αare␈αto␈αbe␈αrepeated␈αfrequently,␈αthe
␈↓result of which is a decision whether or not to trigger the conclusion of the monitor.
␈↓These␈α
various␈α
types␈α
of␈α
processes␈α
are␈α
scheduled␈α
by␈α
a␈α
combination␈α
of␈α
priority␈α
structure␈α
and␈α
time-
␈↓slot␈α
request␈α
disciplines.␈α
Joint␈α
servos␈α
are␈α
critical␈α
in␈α
the␈α
sense␈α
that␈α
the␈α
calculations␈α
they␈α
make␈αare
␈↓highly␈αtime-dependent;␈αthey␈αmust␈αbe␈αguaranteed␈αnot␈αto␈αbe␈αinterrupted.␈α Therefore,␈αthey␈αoperate␈αat
␈↓a␈αvery␈αhigh␈αsoftware␈αpriority.␈α On-monitors␈αare␈α
less␈αcritical,␈αand␈αthey␈αoperate␈αat␈αa␈α
lower␈αpriority.
␈↓Interpreters␈αrun␈αat␈α
the␈αlowest␈αpriority.␈α Both␈α
joint␈αservos␈αand␈αon-monitors␈α
are␈αtasks␈αwhich␈αneed␈α
to
␈↓be␈αawakened␈αperiodically.␈α Therefore,␈αtime␈αis␈αdivided␈αinto␈αslots␈αone␈αmillisecond␈αwide.␈α One␈αservo
␈↓and␈αany␈αnumber␈αof␈α
on-monitors␈αcan␈αreserve␈αa␈α
time␈αslot;␈αwhen␈αthat␈α
time␈αarrives,␈αthe␈αservo␈αis␈α
given
␈↓guaranteed␈αcontrol,␈αand␈αwhen␈αit␈αterminates,␈αall␈αrequesting␈αon-monitors␈αare␈αallowed␈αto␈αuse␈αthe␈αtime
␈↓remaining␈α
in␈α
the␈α
slot.␈α
After␈α
all␈α∞these␈α
critical␈α
requests␈α
are␈α
satisfied,␈α
any␈α
running␈α∞interpreter␈α
uses
␈↓the␈α
time␈α
left␈α
over␈α
until␈α
the␈α
next␈α
slot␈α
begins.␈α
Appendix␈α
II␈α
describes␈α
the␈α
instructions␈α
available␈α
to
␈↓the␈α
interpreter,␈α
the␈α
tables␈α
emitted␈α
for␈α
motions,␈α
the␈α
nature␈α
of␈α
joint␈α
servos,␈α
and␈α
the␈αpriority␈α
interrupt
␈↓and scheduling structure in greater detail.
␈↓␈↓∧6.2 DATA STRUCTURES␈↓
␈↓␈↓β6.2.1 VALUE CELLS␈↓
␈↓Values␈α⊃are␈α⊃stored␈α⊃in␈α⊃cells;␈α⊃each␈α⊃datatype␈α⊃has␈α⊃its␈α⊃own␈α⊃format␈α⊃for␈α⊃the␈α⊃value␈α∩cell.␈α⊃ Fixed-point
␈↓numbers are used throughout.
␈↓Scalars are stored in a single word, in fixed-point format.
␈↓Vectors␈α∩are␈α⊃stored␈α∩in␈α⊃four␈α∩consecutive␈α∩words.␈α⊃ The␈α∩fourth␈α⊃entry␈α∩is␈α⊃usually␈α∩1;␈α∩the␈α⊃arithmetic
␈↓routines␈αare␈αoptimized␈αfor␈αsuch␈αnormalized␈αvectors.␈α To␈αnormalize␈αa␈αvector,␈αdivide␈αeach␈αentry␈αby
␈↓the fourth one.
␈↓Planes␈α
are␈αalso␈α
stored␈αin␈α
four␈αwords.␈α
The␈αfirst␈α
three␈αrepresent␈α
an␈αoutward-facing␈α
normal,␈αand␈α
the
␈↓last is the negative distance to the (table) origin.
␈↓Frames␈α
are␈αstored␈α
as␈α
4x4␈αarrays,␈α
by␈α
columns.␈α In␈α
addition,␈α
there␈αare␈α
6␈α
words␈αset␈α
aside␈α
for␈αthe␈α
joint
␈↓angles␈α
associated␈α
with␈α∞the␈α
frame,␈α
that␈α∞is,␈α
the␈α
angles␈α
necessary␈α∞for␈α
one␈α
of␈α∞the␈α
arms␈α
to␈α∞reach␈α
that
␈↓point␈αin␈αspace.␈α There␈αare␈αa␈αfew␈αbits␈αto␈αtell␈αwhich␈αarm␈αis␈αmeant␈αand␈αwhether␈αthe␈αjoint␈αangles␈αare
␈↓valid,␈αthat␈αis,␈αwhether␈αthey␈αhave␈αbeen␈α
calculated␈αsince␈αlast␈αthe␈αframe's␈αvalue␈αwas␈α
changed.␈α Joint
␈↓angles␈α∞are␈α∞calculated␈α∞only␈α∞if␈α∞needed.␈α∞ This␈α∞happens␈α∞if␈α∞the␈α∞frame␈α∞is␈α∞being␈α∞used␈α∞as␈α∞a␈α∞point␈α∂in␈α∞a
␈↓trajectory.
␈↓Transes are stored in two 4x4 arrays: One holds the trans itself, and the other the inverse.
␈↓Page 76␈α?␈α?␈α?␈α?␈α?␈α?␈α)DATA STRUCTURES␈↓ ∂6.2.2
␈↓␈↓β6.2.2 GRAPH STRUCTURES␈↓
␈↓Variables␈αare␈αallocated␈α"node␈αcells".␈α These␈αcells␈αhave␈αa␈αpointer␈αto␈αthe␈αvalue␈αcell,␈αas␈αwell␈αas␈αother
␈↓fields used in graph structure manipulation.
␈↓NODE CELL
␈↓␈↓ αHinvmark␈α
--␈α
=0␈α
if␈α
value␈α
is␈α
valid,␈α
otherwise␈α
invalid␈α
(note:␈α
the␈α
evalnode␈α
algorithm␈α
uses␈α
a
␈↓␈↓ βH"time" to detect cycles. Therefore, this field needs to be (at least) 16 bits.
␈↓␈↓ αHvalue -- pointer to a value cell.
␈↓␈↓ αHcalculator -- points to a list of calculator cells
␈↓␈↓ αHchanger␈α⊃--␈α⊃points␈α⊃to␈α⊃a␈α⊃block␈α⊂of␈α⊃interpretable␈α⊃code.␈α⊃There␈α⊃are␈α⊃a␈α⊃few␈α⊂special-purpose
␈↓␈↓ βHchangers which do not point to any code, but are used as shorthands.
␈↓␈↓ αHdependents -- points to a list of dependents
␈↓␈↓ αHtype -- encoding (in several bits) of datatype.
␈↓CALCULATOR CELL
␈↓␈↓ αHlink -- link to next on the chain (there can be more than one calculator for a node).
␈↓␈↓ αHneeded␈α⊃--␈α⊃points␈α⊃to␈α⊃list␈α⊃of␈α⊂variables␈α⊃needed␈α⊃for␈α⊃this␈α⊃calculator.␈α⊃The␈α⊃dependents␈α⊂cell
␈↓␈↓ βHformat is used for the needed list.
␈↓␈↓ αHcode -- points to a block of interpretable code.
␈↓DEPENDENTS CELL
␈↓␈↓ αHlink -- link to next on the chain (there can be more than one dependent of a node).
␈↓␈↓ αHdep -- points to the node cell of one dependent.
␈↓The␈α∩algorithms␈α∪used␈α∩to␈α∪extract␈α∩values␈α∪from␈α∩and␈α∩insert␈α∪values␈α∩into␈α∪the␈α∩graph␈α∪structure␈α∩are
␈↓described in Appendix II.
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α4PROGRAM FORMULATION␈↓
aPage 77
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0␈↓∧CHAPTER 7␈↓
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α!␈↓¬USER FEATURES␈↓
␈↓The␈α
HAL␈αsystem␈α
is␈α
intended␈αto␈α
be␈αa␈α
flexible␈α
tool␈αfor␈α
the␈αplanning␈α
of␈α
complex␈αassembly␈α
tasks␈αby␈α
a
␈↓skilled␈αoperator.␈α This␈αplanning␈αhas␈αseveral␈αphases:␈αinitial␈αpreparation␈αof␈αthe␈αprogram,␈αremoving
␈↓syntactic␈α
errors␈αfrom␈α
the␈αsource␈α
code,␈α
trying␈αthe␈α
program␈αout,␈α
and␈α
fixing␈αdiscovered␈α
bugs␈αuntil␈α
the
␈↓program␈αworks␈αproperly.␈α The␈αfinal␈αstage␈αis␈αthe␈αproduction␈αrun␈αof␈αthe␈αprogram,␈αwhich␈αcan␈αoccur
␈↓in␈α
a␈α
basically␈α
unsupervised␈α∞mode.␈α
During␈α
execution,␈α
however,␈α
it␈α∞is␈α
still␈α
possible␈α
to␈α∞interrupt␈α
the
␈↓machine␈α∂and␈α∞find␈α∂out␈α∞exactly␈α∂where␈α∞it␈α∂is␈α∂in␈α∞the␈α∂plan␈α∞and␈α∂debug␈α∞it␈α∂further.␈α∞This␈α∂is␈α∂useful␈α∞for
␈↓patching␈α⊂a␈α⊂program␈α∂which␈α⊂over␈α⊂the␈α⊂course␈α∂of␈α⊂a␈α⊂long␈α⊂execution␈α∂begins␈α⊂to␈α⊂"drift"␈α⊂from␈α∂reality.
␈↓Thus, the user features can be divided roughly into these parts:
␈↓␈↓∧7.1 PROGRAM FORMULATION␈↓
␈↓It␈αis␈αhoped␈αthat␈αthe␈αHAL␈αlanguage␈αdescribed␈αin␈αsome␈αdetail␈αearlier␈αprovides␈αa␈αclear␈αand␈αcomplete
␈↓system␈αin␈αwhich␈αto␈αexpress␈αthose␈αmanipulations␈αnecessary␈αfor␈αthe␈αcorrect␈αexecution␈αof␈αan␈α
assembly
␈↓task.␈α
The␈α
structured␈α
concept␈αof␈α
statement,␈α
made␈α
powerful␈αby␈α
the␈α
relatively␈α
unstructured␈αconcept
␈↓of␈α
the␈α
on-monitor,␈α
should␈α
make␈α
writing␈α
in␈α
HAL␈α
relatively␈α
easy.␈α
One␈α
other␈α
way␈α
in␈α∞which␈α
HAL
␈↓can␈αassist␈αthe␈αprogrammer␈αis␈αthat␈αshe␈αcan␈αhave␈αit␈αread␈αthe␈αcurrent␈αlocation␈αof␈αan␈αarm␈αand␈αto␈αuse
␈↓that␈αframe␈αas␈αa␈αconstant␈αin␈αher␈αprogram.␈α This␈αmakes␈αprogramming␈αby␈αdoing␈αpossible.␈α One␈αway
␈↓to␈α
put␈α
together␈α
a␈α
simple␈α
program␈α
is␈α
merely␈α
to␈α
move␈α
the␈α
arm␈α
manually␈α
to␈α
the␈α∞different␈α
locations
␈↓desired,␈α⊗have␈α⊗the␈α⊗system␈α∃remember␈α⊗those␈α⊗locations,␈α⊗and␈α∃then␈α⊗type␈α⊗in␈α⊗appropriate␈α∃motion
␈↓commands between these points.
␈↓␈↓∧7.2 PROGRAM COMPILATION␈↓
␈↓The␈α∂supervisor␈α∂is␈α∂the␈α∂key␈α∂to␈α∂this␈α∂and␈α∂the␈α∂following␈α∂features;␈α∂it␈α∂allows␈α∂the␈α∂user␈α∂to␈α⊂oversee␈α∂the
␈↓progress␈α∞of␈α∞her␈α∞program␈α∞and␈α∞fix␈α∞errors␈α∞as␈α∞they␈α∞arise.␈α∞ There␈α∞is␈α∞a␈α∞simple␈α∂"supervisor␈α∞language"
␈↓intended␈α∞for␈α
communication␈α∞with␈α
the␈α∞HAL␈α
system.␈α∞ Some␈α
of␈α∞its␈α
commands␈α∞are␈α∞demonstrated␈α
in
␈↓the␈α∞sample␈α∞dialog␈α∞given␈α∞in␈α∞Chapter␈α∞8.␈α∂ One␈α∞of␈α∞the␈α∞commands␈α∞causes␈α∞compilation␈α∞to␈α∂begin;␈α∞the
␈↓parser␈α
is␈α∞directed␈α
to␈α∞read␈α
some␈α∞file.␈α
An␈α∞option␈α
is␈α
to␈α∞have␈α
console␈α∞input␈α
itself␈α∞used␈α
to␈α∞enter␈α
the
␈↓source␈α
code;␈α
this␈α
is␈α
especially␈α
useful␈α
in␈αcausing␈α
the␈α
arm␈α
to␈α
do␈α
something␈α
immediately.␈α
When␈αthe
␈↓parser␈α
finds␈α
a␈α
syntax␈α
error,␈α
it␈α
will␈α
give␈αan␈α
error␈α
message,␈α
and␈α
several␈α
options␈α
will␈α
in␈α
general␈αbe
␈↓available.␈α
These␈α
include␈αaborting␈α
the␈α
compilation,␈αskipping␈α
to␈α
the␈αend␈α
of␈α
the␈α
current␈αstatement,
␈↓editing␈α
the␈α
line␈α
with␈α
the␈α∞system␈α
line␈α
editor␈α
(after␈α
which␈α∞the␈α
entire␈α
statement␈α
will␈α
be␈α∞reparsed,␈α
if
␈↓possible),␈α∞and␈α∂temporarily␈α∞switching␈α∂to␈α∞a␈α∂text␈α∞editor␈α∂to␈α∞fix␈α∂the␈α∞problem␈α∂(after␈α∞which␈α∂the␈α∞entire
␈↓program␈αmust␈αbe␈αreparsed).␈α The␈αexpander␈αcan␈αalso␈αfind␈αerrors;␈αthese␈αare␈αusually␈αsemantic␈αerrors,
␈↓like␈α∃generating␈α∃a␈α∀move␈α∃to␈α∃a␈α∀point␈α∃with␈α∃undefined␈α∀planning␈α∃value,␈α∃not␈α∃supplying␈α∀enough
␈↓information␈αto␈αa␈αhigh-level␈αprimitive,␈αor␈αattempting␈αto␈αmove␈αthe␈αsame␈αarm␈αsimultaneously␈αin␈αtwo
␈↓blocks␈αof␈αcode.␈α In␈αthose␈αcases␈αwhere␈αthe␈αproblem␈αis␈αone␈αof␈αinsufficient␈αinformation,␈αthe␈αexpander
␈↓Page 78␈α?␈α?␈α?␈α?␈α?␈α8PROGRAM COMPILATION␈↓ $7.2
␈↓will␈α∪prompt␈α∪for␈α∪more,␈α∪and,␈α∪if␈α∪possible,␈α∪continue.␈α∪ The␈α∪user␈α∪may␈α∪decide␈α∪not␈α∪to␈α∪supply␈α∩that
␈↓information,␈αand␈αin␈αthat␈αcase,␈αthe␈αoffending␈αstatement␈αis␈αflushed.␈α Some␈αerrors␈αare␈αso␈αdrastic␈αas␈αto
␈↓require␈α
complete␈α
recompilation;␈α
the␈α
user␈α
is␈α
always␈α
given␈α
the␈α
option␈α
of␈α
switching␈α
to␈α
a␈α∞text␈α
editor
␈↓for␈α∞major␈α
modifications.␈α∞ There␈α
is␈α∞a␈α
limited␈α∞number␈α
of␈α∞errors␈α
which␈α∞the␈α
trajectory␈α∞calculator␈α
is
␈↓capable␈αof␈αdiscovering.␈α These␈αmostly␈α
involve␈αmotions␈αbeyond␈αthe␈αcapability␈αof␈α
the␈αmanipulators
␈↓involved.␈α⊃ Options␈α∩to␈α⊃the␈α∩user␈α⊃include␈α∩making␈α⊃the␈α∩best␈α⊃legal␈α∩trajectory␈α⊃possible,␈α∩causing␈α⊃the
␈↓trajectory to be slowed down, and putting in a null trajectory.
␈↓␈↓∧7.3 PROGRAM EXECUTION␈↓
␈↓After␈α∞a␈α∞program␈α∞has␈α
been␈α∞compiled,␈α∞it␈α∞resides␈α
on␈α∞disk␈α∞as␈α∞a␈α
load␈α∞module.␈α∞ Any␈α∞number␈α∞of␈α
load
␈↓modules␈α∂can␈α∂be␈α∂loaded␈α∞together;␈α∂the␈α∂principal␈α∂restriction␈α∞is␈α∂that␈α∂each␈α∂of␈α∞them␈α∂be␈α∂a␈α∂"top␈α∞level"
␈↓program.␈α
As␈α
mentioned␈α
earlier,␈α
the␈α
loader␈αwill␈α
resolve␈α
calls␈α
between␈α
the␈α
large␈α(planning)␈α
computer
␈↓and␈α∞the␈α∞small␈α∞(execution)␈α∞computer␈α∞for␈α∂those␈α∞functions␈α∞which␈α∞the␈α∞user␈α∞has␈α∞decided␈α∂require␈α∞the
␈↓computational␈α∪ability␈α∪found␈α∪only␈α∪on␈α∀the␈α∪large␈α∪computer.␈α∪ Execution␈α∪is␈α∪initiated␈α∀by␈α∪another
␈↓supervisor␈α
command␈α
issued␈αby␈α
the␈α
user.␈α
While␈αthe␈α
mini␈α
is␈α
executing␈αthe␈α
program,␈α
the␈α
user␈αcan
␈↓cause␈α∂an␈α∂interruption␈α∂and␈α∂examine␈α∂values␈α∂within␈α∂the␈α∂runtime␈α∂system,␈α∂and␈α∂modify␈α∂them␈α∂if␈α∞she
␈↓wishes.␈α
It␈α
is␈α
also␈αpossible␈α
to␈α
examine␈α
the␈αcode␈α
generated␈α
by␈α
the␈α
compiler␈αand␈α
modify␈α
it,␈α
but␈αthis␈α
is
␈↓most␈α∃likely␈α∀only␈α∃of␈α∃interest␈α∀to␈α∃system␈α∃programmers.␈α∀ Sizable␈α∃patches␈α∃require␈α∀recompilation.
␈↓Sometimes␈αhardware␈α
difficulties␈αwill␈αcause␈α
abrupt␈αtermination␈α
of␈αthe␈αprogram;␈α
these␈αoften␈αare␈α
due
␈↓to␈αruntime␈αtrajectory␈αmodifications␈αoverstraining␈αthe␈αhardware.␈α After␈αissuing␈αan␈αerror␈αmessage␈αto
␈↓the␈α∂user,␈α∂the␈α∂system␈α∂behaves␈α∂just␈α∂as␈α∂it␈α∂would␈α∂should␈α∂it␈α∂have␈α∂been␈α∂interrupted␈α∂manually.␈α∂ It␈α∞is
␈↓possible,␈αduring␈αone␈α
of␈αthese␈α"breaks",␈αto␈α
request␈αthat␈αthe␈αentire␈α
world␈αbe␈αsaved.␈α This␈α
causes␈αall
␈↓runtime␈α
values␈αto␈α
be␈α
written␈αout␈α
into␈αa␈α
safe␈α
place,␈αalong␈α
with␈α
the␈αcurrent␈α
attachment␈αstructure␈α
and
␈↓the␈αcurrent␈αprogram␈αcounters.␈α There␈αare␈αseveral␈αuses␈αfor␈αthis␈αfeature:␈αit␈αallows␈αthe␈αdebugging␈αof
␈↓the␈αtask␈αto␈αstop␈αtemporarily␈αand␈αto␈αbe␈αresumed␈αlater.␈α More␈αimportant,␈αit␈αplants␈αa␈α"safe␈α
point"␈αin
␈↓the␈αcode,␈αso␈αthat␈αif␈αan␈αerror␈αshould␈αoccur␈αlater,␈αit␈αis␈αpossible␈αto␈αback␈αup␈αthe␈αprogram␈αto␈αa␈αpoint␈α
at
␈↓which␈α⊂everything␈α⊃was␈α⊂still␈α⊂working.␈α⊃ Programs␈α⊂which␈α⊂have␈α⊃been␈α⊂completely␈α⊂debugged␈α⊃can␈α⊂be
␈↓"unloaded", that is, saved in a dump file for execution any time in the future.
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∧SAMPLE DIALOG␈↓
aPage 79
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0␈↓∧CHAPTER 8␈↓
␈↓␈α?␈α?␈α?␈α
␈↓¬EXAMPLE DIALOG WITH THE HAL SYSTEM␈↓
␈↓Here␈α∩is␈α∩a␈α∩sample␈α∩conversation␈α∩a␈α∩user␈α∩might␈α∩have␈α∩with␈α∩HAL.␈α∩It␈α∩demonstrates␈α∩the␈α⊃following
␈↓features:␈αTyping␈αin␈αsource␈αcode␈α
by␈αhand,␈αrequesting␈αsource␈αcode␈α
to␈αbe␈αread␈αfrom␈αa␈αfile,␈α
immediate
␈↓execution␈α
of␈α
commands␈αby␈α
the␈α
arm,␈αreturn␈α
of␈α
values␈αfrom␈α
the␈α
arm,␈αloading␈α
compiled␈α
code␈αinto␈α
the
␈↓runtime␈α⊂computer,␈α⊂and␈α⊂executing␈α⊂that␈α⊂code.␈α⊂ The␈α⊂supervisor␈α⊂prompts␈α⊂with␈α⊂the␈α⊂sign␈α⊂"⊃".␈α⊂ The
␈↓material in the right-hand column is explanatory.
␈↓ε⊃ COMPILE TTY | Request to read in from
␈↓ε | console for compilation.
␈↓ε⊂ type <alt> when done ⊃ | Message from supervisor
␈↓εMOVE YELLOW | Simple move statement
␈↓ε TO [(20 30 1):(π 0 0)]; | Destination
␈↓εFRAME PLACE1; | Declaration
␈↓εPLACE1 ← YELLOW; | Assignment
␈↓εPLACE2 ← PLACE1+(0 0 5); | Assignment
␈↓ε⊂ OK to declare PLACE2 a FRAME? ⊃ YES | Parser error, with option.
␈↓ε$ | End of file (altmode)
␈↓ε⊂ no errors. compiled: TTY(1) ⊃ | Compiler message.
␈↓ε⊃ IMMEDIATE | Request for an immediate
␈↓ε | action
␈↓ε⊂ type <alt> when done ⊃ | Message from supervisor
␈↓εMOVE YELLOW TO PARK $ | User wants to park the arm
␈↓ε⊂ done ⊃ | And does
␈↓ε⊃ EXECUTE | Request to execute compiled
␈↓ε | code
␈↓ε⊂ loading TTY(1) ⊃ | First, loading to be done
␈↓ε⊂ executing TTY(1) ⊃ | Message as execution starts
␈↓ε⊂ done ⊃ | Message at end of execution
␈↓ε⊃ READ PLACE3 ← YELLOW | Ask to read hand position
␈↓ε⊂ OK to declare PLACE3 a FRAME? ⊃ YES | Use of undeclared variable
␈↓ε⊂ PLACE3 = [(19.9, 30.1, 1.1):(3.1, 0, 0.1)] ⊃
␈↓ε | Indication of what was set
␈↓ε⊃ VALUE PLACE4 | Ask for value of variable
␈↓ε⊂ PLACE4 not declared. Declare it a ⊃ | User has chance to fix
␈↓ε⊂ Please retype command ⊃ | simple errors.
␈↓ε⊃ PLANVALUE V1 | Request for planning value
␈↓ε⊂ (V1) = (3.0, 0, 20.13) ⊃ |
␈↓ε⊃ PLANVALUE V1 ← (4.0, 0, 20.13) | User can change planvalues.
␈↓ε⊃ VALUE V1 ← (4.0, 0, 20.13) | User can change real values.
␈↓ε⊃ COMPILE HACK.HAL[1,LOU] | Ask for compile from file
␈↓ε⊂ Error in line 310 of HACK.HAL[1,LOU]. | Parser error message
␈↓ε THEN | Gives line with <lf>
␈↓ε STUP | at point of error
␈↓εOption ⊃ ? | User typed "?"
␈↓εI: Insert replacement text | A list of options to user
␈↓εZ: Use line editor to fix |
␈↓εM: Show more context | This would give entire
␈↓εF: Flush to end of statement | statement
␈↓εE: Switch to E | E is a text editor
␈↓εS: Switch to SOS | SOS is a text editor
␈↓εQ: Quit. Abort compilation |
␈↓εOption ⊃ I | User chooses to insert
␈↓ε | replacement
␈↓ε⊂ type <alt> when done ⊃ | Message from supervisor
␈↓Page 80␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβSAMPLE DIALOG␈↓ H
␈↓ε THEN STOP | "STUP" changed to "STOP"
␈↓ε$ | End of insertion
␈↓ε⊂ error in line 520 of HACK.HAL[1,LOU]. | trajectory calculator error
␈↓ε | message
␈↓ε MOVE YELLOW | Only first line of
␈↓ε | statement given
␈↓εThe desired motion goes out of bounds in joint 3
␈↓εin the first segment of motion. |
␈↓ε | A bad motion
␈↓εOption ⊃ E | User wants to edit with E.
␈↓ε⊂ Switching to E. To return, <CTR>XG<CR> ⊃
␈↓ε | Universe is saved for retry
␈↓ε⊂ Welcome back to HAL. | Editing done
␈↓εCompilation of HACK.HAL[1,LOU] aborted⊃ | After an edit, compilation
␈↓ε | aborts.
␈↓ε⊃ COMPILE HACK.HAL[1,LOU] | Request for recompilation
␈↓ε⊂ No errors. Compiled: TTY(1), HACK.HAL[1,LOU] ⊃
␈↓ε | Compilation succeeds.
␈↓ε⊃ LOAD | Request to load into servo
␈↓ε⊂ Loaded: TTY(1), HACK.HAL[1,LOU] ⊃ |
␈↓ε⊃ STATUS | User wants to know where
␈↓ε | she is
␈↓εBLUE at [(19.9, 30.1, 1.1) : (3.1, 0, 0.1)]
␈↓ε | Arm location
␈↓εCompiled: TTY(1), HACK.HAL[1,LOU] | Compilation status
␈↓εLoaded: TTY(1), HACK.HAL[1,LOU] | Runtime status
␈↓ε⊃ EXECUTE | Request for execution
␈↓ε⊂ Executing TTY(1), HACK.HAL[1,LOU] ⊃ |
␈↓ε⊃ STATUS | User wants to know where
␈↓ε | she is
␈↓εBLUE at [(24.1, 30.1, 5.3) : (3.1, 0, 0)] moving
␈↓ε | Arm status
␈↓εInterpreter at line 320 in HACK.HAL[1,LOU]
␈↓ε | Servo status
␈↓ε⊂ Interrupted by red button⊃ | Runtime error message. User
␈↓ε | interrupted motion.
␈↓εInterpreter at line 180 of HACK.HAL[1,LOU]
␈↓ε | Servo status
␈↓ε⊃ PROCEED | Request to continue motion
␈↓ε⊂ Joint 4 has excessive force. | Runtime error message.
␈↓εInterpreter at line 150 of HACK.HAL[1,LOU]
␈↓ε | Servo status
␈↓ε⊃ DELETE 1 | Request to delete last
␈↓ε | compilation
␈↓ε⊂ Deleting HACK.HAL from runtime | Removed from runtime
␈↓ε⊂ Deleting HACK.HAL from COMPILATION | Removed from world of
␈↓ε | compiler
␈↓ε⊃ E | Switch to E.
␈↓ε⊂ Switching to E. To return, <CTR>XG<CR>⊃
␈↓ε⊂ Welcome back to HAL⊃ |
␈↓ε⊃ COMPILE HACK.HAL[1,LOU] | Request for compilation
␈↓ε⊂ No errors. Compiled: TTY(1), HACK.HAL[1,LOU] ⊃
␈↓ε | Compilation succeeds
␈↓ε⊃ SAVE WORLD IN W1 | User wants world saved in
␈↓ε⊂ World saved in W1.WLD ⊃ | named location.
␈↓ε⊃ RESTORE WORLD FROM W0 | Request to restore previous
␈↓ε | world
␈↓ε⊂ W0.WLD not found ⊃ | Expander error message
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∧SAMPLE DIALOG␈↓
aPage 81
␈↓ε⊃ RESTORE WORLD FROM W00 | Request to restore previous
␈↓ε | world
␈↓ε⊂ done |
␈↓εNote: TTY(1), HACK.HAL[1,LOU] still compiled. ⊃
␈↓ε | This is done, but previous
␈↓ε | stuff is still around.
␈↓ε⊃ BYE | Request to leave the room.
␈↓ε⊂ Final status: | A final status rundown
␈↓εLoad modules ready: TTY(1).HLD, HACK.HLD
␈↓εBLUE at [(19.9, 30.1, 1.1) : (3.1, 0, 0.1)]
␈↓εGoodbye ⊃
␈↓εEXIT
␈↓ε.␈↓
␈↓Page 82␈α?␈α?␈α?␈α?␈α?␈α?␈α/VISUAL FEEDBACK␈↓ H
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α0␈↓∧CHAPTER 9␈↓
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α.␈↓¬EXTENSIONS TO HAL␈↓
␈↓␈↓∧9.1 INCORPORATING VISUAL FEEDBACK␈↓
␈↓␈↓β9.1.1 NECESSARY CAPABILITIES␈↓
␈↓This␈αis␈αa␈αlist␈αof␈αcapabilities␈αwhich␈αwould␈αhave␈αto␈αbe␈αimplemented␈αin␈αorder␈αto␈αdo␈αdynamic␈αvisual
␈↓feedback within HAL.
␈↓PICTURE BUFFERS AND WINDOWS
␈↓We␈α∞need␈α∞a␈α
new␈α∞datatype,␈α∞PICTURE,␈α∞to␈α
contain␈α∞a␈α∞digitized␈α
picture,␈α∞information␈α∞on␈α∞the␈α
camera
␈↓used␈α(particularly␈α
its␈αlocation␈α
and␈αorientation),␈αwhat␈α
lens␈αwas␈α
used,␈αwhat␈α
filters,␈αand␈αperhaps␈α
other
␈↓information.
␈↓Subpictures,␈α∩that␈α∪is␈α∩windows,␈α∪should␈α∩be␈α∪extractible␈α∩from␈α∩the␈α∪picture␈α∩itself,␈α∪so␈α∩that␈α∪a␈α∩visual
␈↓processing routine can look at whatever part it needs.
␈↓CAMERA CONTROL
␈↓There␈α⊃should␈α⊃be␈α∩a␈α⊃syntax␈α⊃for␈α⊃specifying␈α∩how␈α⊃to␈α⊃move␈α⊃a␈α∩camera␈α⊃to␈α⊃a␈α⊃desired␈α∩location.␈α⊃ For
␈↓example,
␈↓ AIM CAMERA_1 AT (30, 40, 10)
␈↓ USING LENS=2, FILTER=CLEAR, IRIS=2.8;
␈↓There␈α
should␈α
be␈α
a␈α
syntax␈α
for␈α
specifying␈α
that␈α∞a␈α
picture␈α
be␈α
taken␈α
and␈α
stored␈α
in␈α
a␈α∞certain␈α
picture
␈↓buffer.␈α∂ Since␈α∂cameras␈α∂have␈α∞their␈α∂own␈α∂built-in␈α∂synchronization,␈α∞detailed␈α∂timing␈α∂control␈α∂may␈α∞be
␈↓complicated.␈α Read␈αthe␈αEXPLICIT␈αCONTROL␈αOF␈αTIMING␈αsection␈αbelow␈αfor␈αsome␈αmore␈αideas
␈↓on this subject.
␈↓OBJECT MODELS
␈↓There␈αshould␈αbe␈αsufficiently␈αpowerful␈αdata␈αstructures␈α(such␈αas␈αarrays␈αand␈αlist␈αstructures)␈αavailable
␈↓to implement complex object descriptions such as a network of features.
␈↓It␈α
should␈α∞be␈α
possible␈α∞to␈α
implement␈α
programs␈α∞which␈α
find␈α∞predicted␈α
objects␈α
in␈α∞pictures␈α
by␈α∞use␈α
of
␈↓modeling␈α∞information.␈α∞ This␈α∞may␈α∞involve␈α∞the␈α∞use␈α
of␈α∞recursion␈α∞and␈α∞backup,␈α∞neither␈α∞of␈α∞which␈α
is
␈↓currently available.
␈↓9.1.1␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αλVISUAL FEEDBACK␈↓
aPage 83
␈↓VISUAL PROCESSING PRIMITIVES
␈↓There␈α
should␈αbe␈α
a␈α
mechanism␈αfor␈α
calling␈αPDP11␈α
and␈α
SPS41␈αroutines␈α
which␈αshare␈α
data␈α
such␈αas
␈↓pictures␈αand␈αobject␈α
models.␈α (The␈αSPS41␈α
is␈αa␈αsignal␈α
processor␈αwhich␈αwe␈α
will␈αuse␈αfor␈α
some␈αvision
␈↓work.) To an extent, this already exists with the EXTERNAL PDP11 procedure.
␈↓MOTIONS OF ACCOMODATION
␈↓There␈α∞should␈α∂be␈α∞a␈α∞way␈α∂of␈α∞specifying␈α∞how␈α∂to␈α∞servo␈α∞an␈α∂arm␈α∞based␈α∞upon␈α∂visual,␈α∞force,␈α∂or␈α∞tactile
␈↓information.␈α∂ The␈α∂arm␈α∞is␈α∂expected␈α∂to␈α∂change␈α∞its␈α∂trajectory␈α∂as␈α∂a␈α∞function␈α∂of␈α∂sensory␈α∂input;␈α∞this
␈↓would␈α⊗allow␈α⊗visual␈α∃servoing,␈α⊗for␈α⊗example.␈α∃ An␈α⊗implementation␈α⊗would␈α⊗involve␈α∃dynamically
␈↓changing␈α
the␈α
arm's␈α
destination␈α
or␈α
dynamically␈αspecifying␈α
relative␈α
changes␈α
to␈α
be␈α
made.␈α
In␈αeither
␈↓case, time is an important variable. Consider a typical sequence of events:
␈↓␈↓ αH(1)␈αA␈αpicture␈αis␈αtaken␈αof␈αthe␈αarm.␈α (2)␈αThe␈αpicture␈αis␈αanalyzed␈αto␈αdetermine␈αan
␈↓␈↓ αHarm␈α∀correction.␈α∀ (3)␈α∀While␈α∀the␈α∀visual␈α∀processing␈α∀is␈α∀being␈α∀done,␈α∀the␈α∀arm
␈↓␈↓ αHcontinues␈αto␈αmove.␈α Hence␈αa␈αprediction␈αshould␈αbe␈αmade␈αand␈αincorporated␈αinto
␈↓␈↓ αHthe specified correction. (4) The correction is sent to the servo.
␈↓EXPLICIT CONTROL OF TIMING
␈↓As␈αpointed␈αout␈αabove,␈αtime␈αis␈αan␈αimportant␈αfactor␈αwithin␈αvisual␈αfeedback.␈α To␈αdo␈αvisual␈αfeedback
␈↓the␈α∞user␈α∞almost␈α
has␈α∞to␈α∞deal␈α∞with␈α
the␈α∞scheduling␈α∞problems␈α∞at␈α
a␈α∞different␈α∞level␈α∞than␈α
COBEGIN-
␈↓COEND␈α∩or␈α∪even␈α∩EVENTs.␈α∪ There␈α∩should␈α∪be␈α∩a␈α∩way␈α∪of␈α∩accessing␈α∪the␈α∩clock␈α∪and␈α∩a␈α∪way␈α∩of
␈↓guaranteeing a certain amount of time for visual processing once a picture has been taken.
␈↓It␈αwould␈αalso␈αbe␈αuseful␈αto␈αseparate␈αthe␈α`setup'␈αfor␈αa␈αMOVE␈αfrom␈αthe␈αactual␈αbeginning␈αof␈αa␈αmove.
␈↓This␈αsuggests␈αa␈α
setup␈αand␈αtrigger␈α
mechanism␈αto␈αsqueeze␈α
as␈αmuch␈αprocessing␈α
as␈αpossible␈αinto␈α
"free"
␈↓PDP11 time.
␈↓INTERACTIVE DESIGN OF VISUAL PROCESSING
␈↓There␈α∀should␈α∀be␈α∃an␈α∀interface␈α∀to␈α∃a␈α∀graphics␈α∀system␈α∃such␈α∀as␈α∀Bruce␈α∃Baumgart's␈α∀GEOMED
␈↓[Baumgart]␈α∞so␈α∞the␈α∞user␈α∞can␈α∞symbolically␈α
position␈α∞the␈α∞assembly␈α∞parts␈α∞and␈α∞cameras,␈α∞simulate␈α
arm
␈↓motions,␈α∩and␈α∩extract␈α∪potential␈α∩object␈α∩models␈α∩from␈α∪synthetic␈α∩pictures.␈α∩ The␈α∪system␈α∩supervisor
␈↓should␈α⊃be␈α⊃flexible␈α⊃enough␈α⊃to␈α⊃allow␈α⊃the␈α⊃user␈α⊃to␈α⊃interactively␈α⊃manipulate␈α⊃the␈α⊃actual␈α⊃arms␈α⊂and
␈↓cameras␈α∂so␈α∂that␈α∂the␈α∂resulting␈α∂TV␈α⊂pictures␈α∂correspond␈α∂with␈α∂the␈α∂synthetic␈α∂views.␈α⊂ This␈α∂involves
␈↓consistent models of the world.
␈↓␈↓β9.1.2 STAGES IN INCORPORATING VISUAL FEEDBACK␈↓
␈↓There␈α
are␈α
roughly␈α
three␈α
different␈α
stages␈α
in␈α
the␈α
process␈α
of␈α
incorporating␈α
visual␈α
feedback␈α
into␈α
HAL:
␈↓(1)␈α∪completely␈α∀separate␈α∪modules,␈α∀(2)␈α∪picture␈α∪taking␈α∀within␈α∪HAL␈α∀but␈α∪models␈α∀and␈α∪processing
␈↓separate, and (3) everything in HAL. These stages are briefly discussed below.
␈↓COMPLETELY SEPARATE MODULES
␈↓Page 84␈α?␈α?␈α?␈α?␈α?␈α?␈α/VISUAL FEEDBACK␈↓ ∂9.1.2
␈↓This␈αmeans␈αthat␈αthe␈αobject␈αmodules,␈αinterpreters,␈αcamera␈αcontrol␈αroutines,␈αetc.␈αare␈αin␈αone␈αor␈αmore
␈↓modules␈α∀and␈α∃the␈α∀HAL␈α∀system␈α∃is␈α∀another␈α∀module.␈α∃ Communication␈α∀between␈α∀modules␈α∃is␈α∀by
␈↓messages.␈α⊂ This␈α⊂type␈α⊂of␈α⊃communication␈α⊂restricts␈α⊂the␈α⊂mode␈α⊃of␈α⊂operation;␈α⊂feedback␈α⊂will␈α⊃only␈α⊂be
␈↓available while the arm is not in motion. Motions of accomodation would not be possible.
␈↓The␈αcurrent␈αStanford␈α
hand-eye␈αsystem␈αis␈αof␈α
this␈αform.␈α It␈αwill␈α
be␈αstraightforward␈αto␈α
provide␈αthis
␈↓type␈α∞of␈α∞system␈α∞with␈α∞HAL.␈α∞ However,␈α∞it␈α∂has␈α∞obvious␈α∞limitations␈α∞and␈α∞hopefully␈α∞would␈α∞only␈α∂be␈α∞a
␈↓temporary solution.
␈↓PICTURE TAKING WITHIN HAL
␈↓This␈αis␈αthe␈α
first␈αstep␈αtoward␈αa␈α
complete␈αintegration.␈α HAL␈α
would␈αprovide␈αcamera␈αcontrol,␈α
pictures,
␈↓picture␈αtaking,␈αand␈αways␈αto␈αcall␈αprocedures␈αwhich␈αshare␈αdata.␈α The␈αobject␈αmodels␈αcould␈αeither␈αbe
␈↓written␈α∂in␈α⊂SAIL␈α∂(and␈α∂be␈α⊂on␈α∂the␈α⊂PDP10)␈α∂of␈α∂be␈α⊂written␈α∂in␈α⊂a␈α∂PDP11␈α∂language␈α⊂(and␈α∂be␈α⊂on␈α∂the
␈↓PDP11).␈α∞ In␈α∞either␈α∞case␈α∞the␈α∞models␈α∂and␈α∞pictures␈α∞would␈α∞be␈α∞available␈α∞to␈α∞external␈α∂routines␈α∞which
␈↓analyze␈α
pictures␈α
and␈α
return␈α
improved␈α∞location␈α
values␈α
for␈α
objects.␈α
Visual␈α
servoing␈α∞and␈α
dynamic
␈↓feedback␈αstill␈αcould␈αnot␈αbe␈αdone;␈αthere␈αis␈αno␈αway␈αto␈αcontrol␈αthe␈αscheduling␈αto␈αinsure␈αthe␈αnecessary
␈↓service.
␈↓This␈α∂type␈α∂of␈α∂procedure-calling␈α∂is␈α∂designed␈α∂into␈α∂the␈α∂current␈α∂HAL␈α∂system.␈α∂ It␈α∂mainly␈α⊂involves␈α∂a
␈↓smart␈αloader.␈α The␈αother␈αextensions␈αare␈αreasonably␈αstraightforward;␈αit␈αappears␈αto␈αbe␈αan␈α
easy␈αstep
␈↓up␈α
to␈αthis␈α
type␈α
of␈αsystem.␈α
Its␈α
advantage␈αover␈α
the␈αprevious␈α
system␈α
is␈αthat␈α
the␈α
basic␈αrequirements
␈↓for␈αdoing␈α
visual␈αfeedback␈αare␈α
all␈αdirectly␈αaccessible␈α
from␈αwithin␈αone␈α
system␈α(assuming␈αthe␈α
routines
␈↓are␈αon␈αthe␈αPDP11).␈α This␈αprovides␈αa␈αchance␈αto␈αtry␈αout␈αsome␈αof␈αthe␈αideas␈αbefore␈αmoving␈αon␈αto␈α
the
␈↓next stage.
␈↓COMPLETE INTEGRATION
␈↓Complete␈α
integration␈α
would␈αinvolve␈α
motions␈α
of␈α
accomodation␈αin␈α
full␈α
generality,␈αwith␈α
modifications
␈↓to␈α∂trajectories␈α⊂while␈α∂they␈α∂are␈α⊂being␈α∂executed.␈α∂ Picture␈α⊂taking␈α∂and␈α∂processing␈α⊂would␈α∂all␈α⊂be␈α∂run
␈↓under␈α
HAL,␈αand␈α
they␈αwould␈α
be␈αinterfaced␈α
into␈αthe␈α
timing␈αscheme␈α
to␈αinsure␈α
proper␈α
service.␈α Not
␈↓only␈α
would␈α
true␈α
visual␈α
servoing␈α
be␈α
possible,␈α∞but␈α
also␈α
fine␈α
control␈α
of␈α
the␈α
hand␈α
based␈α∞on␈α
delicate
␈↓touch sensing.
␈↓␈↓∧9.2 DYNAMIC FRAMES ␈↓
␈↓One␈αvery␈αdesirable␈αfeature␈αwould␈αbe␈αan␈αability␈αto␈αdescribe␈αand␈αuse␈αcontinually␈αvarying␈αvariables.
␈↓In␈α∀industrial␈α∀applications,␈α∪for␈α∀instance,␈α∀it␈α∀would␈α∪be␈α∀very␈α∀nice␈α∪if␈α∀the␈α∀runtime␈α∀system␈α∪could
␈↓automatically␈α∞make␈α
the␈α∞corrections␈α∞required␈α
to␈α∞track␈α
an␈α∞object␈α∞on␈α
a␈α∞moving␈α∞conveyor.␈α
Initially,
␈↓this␈αfacility␈αis␈αnot␈αbeing␈αimplemented,␈αalthough␈αwe␈αare␈αstudying␈αthe␈αproblems␈αinvolved.␈α Actually,
␈↓only␈α
a␈α
very␈α
few␈α
new␈α
constructs␈α
would␈α
need␈α
to␈α
be␈α
introduced␈α
into␈α
the␈α
language␈α
to␈α
allow␈αsuch␈α
things
␈↓to␈α∂be␈α∂described.␈α∞ The␈α∂principal␈α∂addition␈α∞required␈α∂is␈α∂a␈α∞way␈α∂of␈α∂warning␈α∞the␈α∂compiler␈α∂that␈α∞some
␈↓variables may be "dynamic". For instance,
␈↓9.2␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α_DYNAMIC FRAMES ␈↓
aPage 85
␈↓ DYNAMIC VECTOR v;
␈↓ DYNAMIC FRAME chain_hoist;
␈↓would␈α
tell␈α
the␈α
compiler␈α
that␈α
v␈αand␈α
conveyor_belt␈α
may␈α
vary␈α
continuously␈α
with␈α
time.␈α Trajectories␈α
to
␈↓any␈α⊂locations␈α⊃that␈α⊂depend␈α⊃on␈α⊂such␈α⊂variables␈α⊃must␈α⊂be␈α⊃handled␈α⊂a␈α⊂bit␈α⊃differently␈α⊂by␈α⊃the␈α⊂servo.
␈↓Instead␈α
of␈αapplying␈α
the␈αbrakes␈α
or␈α
continuing␈αto␈α
null␈αout␈α
a␈αset␈α
of␈α
joint␈αangles␈α
and␈αforces␈α
at␈αthe␈α
end
␈↓of␈αa␈αMOVE,␈α
the␈αservo␈αshould␈α
periodically␈αrecompute␈αthe␈αdestination␈α
location,␈αobtain␈αa␈α
new␈αarm
␈↓solution, and then servo to the new joint values.
␈↓The␈α∞normal␈α∞HAL␈α∞graph␈α∞structures␈α∞are␈α∂readily␈α∞adapted␈α∞to␈α∞such␈α∞dynamic␈α∞values.␈α∂ Essentially␈α∞all
␈↓that␈α∂is␈α∂required␈α∂is␈α∂the␈α∂addition␈α∂of␈α∂a␈α∂special␈α∂reserved␈α∂scalar␈α∂variable␈α∂TIME,␈α∂which␈α∂is␈α∞changed
␈↓every␈αclock␈α
tick,␈αthus␈α
invalidating␈αany␈αvalues␈α
calculated␈αby␈α
expressions␈αthat␈α
depend␈αon␈αTIME␈α
(see
␈↓Section 4.6 and Section II.6). For instance we might have
␈↓ DYNAMIC FRAME conveyor_belt;
␈↓ SCALAR speed; {speed of the conveyor belt}
␈↓ UNITS SECONDS,INCHES;
␈↓ speed ←5; {i.e., 5 inches/second}
␈↓ conveyor_belt <= [(0,speed*TIME,0):(0,0,0)]
␈↓␈↓ βλ␈↓β{␈α
In␈α
this␈α
example,␈αwe␈α
won't␈α
ever␈α
use␈αthe␈α
"true"␈α
location␈α
of␈αthe␈α
belt.␈α
Rather,␈α
we␈αwill
␈↓β␈↓ βλATTACH things to it, so that they are carried along by the belt. }
␈↓ SCALAR t0;
␈↓ REQUIRE "PUMP.075" SOURCE_FILE;
␈↓␈↓ βλ␈↓β{␈αThis␈αdefines,␈αamong␈αother␈αthings,␈αthe␈αframes␈αpumpbase␈αand␈αpumpgrasp.␈α Initially,
␈↓β␈↓ βλsuppose␈α∞that␈α
we␈α∞know␈α∞that␈α
the␈α∞pumpbase␈α∞is␈α
somewhere␈α∞on␈α∞the␈α
conveyor.␈α∞ We␈α∞call␈α
a
␈↓β␈↓ βλvision routine to find it. }
␈↓ VISUALLY_LOCATE(pumpbase,t0);
␈↓␈↓ βλ␈↓β{␈αAlso,␈αset␈αt0␈αto␈αthe␈αvalue␈αof␈αTIME␈αat␈αwhich␈αthe␈αpicture␈αwas␈αtaken␈α(ie␈αthe␈αtime␈αthat
␈↓β␈↓ βλthe pumpbase was at the location set by the procedure) }
␈↓ ATTACH pumpbase TO conveyor_belt AT (pumpbase →[(0,speed*t0,0):(0,0,0)]);
␈↓ { One effect of this is:
␈↓ pumpbase(t) <= (pumpbase(t0)→conveyor(t0))*conveyor;
␈↓ }
␈↓ MOVE YELLOW TO pumpgrasp;
␈↓␈↓ βλ␈↓β{␈α∪Presumably,␈α∪pumpgrasp␈α∪is␈α∪attached␈α∪rigidly␈α∪to␈α∪pumpbase.␈α∪ Since␈α∪pumpbase␈α∩is
␈↓β␈↓ βλattached␈α≤to␈α≤a␈α≤dynamic␈α≤thing␈α≤(conveyor_belt)␈α≤then␈α≤pumpgrasp␈α≤is␈α≠computed
␈↓β␈↓ βλdynamically, too, so that the arm will track the grasp point }
␈↓ CENTER YELLOW;
␈↓ { grasps the object }
␈↓Page 86␈α?␈α?␈α?␈α?␈α?␈α?␈α/DYNAMIC FRAMES ␈↓ $9.2
␈↓ DETACH pumpbase FROM conveyor_belt;
␈↓ ATTACH pumpbase TO YELLOW;
␈↓ MOVE pumpbase TO jig_location_1; { wherever ␈↓βthat␈↓ is}
␈↓It␈αis␈αperhaps␈αworth␈αpointing␈αout␈αthat␈αthere␈αis␈αnothing␈αparticularly␈αmagical␈αabout␈αTIME;␈αa␈αsimilar
␈↓technique␈α∀could␈α∀be␈α∀used,␈α∀say,␈α∀for␈α∀moving␈α∀to␈α∪some␈α∀frame␈α∀whose␈α∀value␈α∀is␈α∀a␈α∀function␈α∀of␈α∪a
␈↓continuously varying A-to-D reading.
␈↓␈↓∧9.3 EXTENSIONS TO OTHER ARMS AND DEVICES␈↓
␈↓The␈αinitial␈α
version␈αof␈αthe␈α
HAL␈αsystem␈αwill␈α
be␈αdesigned␈αto␈α
run␈αwith␈αtwo␈α
Stanford␈αArms,␈α
but␈αthe
␈↓system␈α
is␈α
in␈α∞no␈α
way␈α
limited␈α
to␈α∞any␈α
particular␈α
manipulators.␈α
All␈α∞manipulator-dependent␈α
routines
␈↓are␈α
grouped␈α
together␈α
and␈α∞are␈α
written␈α
in␈α
SAIL;␈α
in␈α∞order␈α
to␈α
interface␈α
another␈α
manipulator␈α∞to␈α
the
␈↓system␈αthese␈αroutines␈αwould␈αhave␈αto␈αbe␈αrewritten,␈αmost␈αnotably␈αthe␈αsolution␈αand␈αdynamics␈αmodels.
␈↓In␈α∂the␈α∂case␈α∂of␈α⊂non-manipulator␈α∂type␈α∂devices,␈α∂such␈α⊂as␈α∂cranes,␈α∂the␈α∂trajectory␈α⊂generating␈α∂routines
␈↓would␈α∞also␈α
need␈α∞rewriting,␈α
but␈α∞as␈α∞we␈α
lack␈α∞any␈α
experience␈α∞in␈α∞this␈α
direction␈α∞we␈α
will␈α∞pursue␈α∞it␈α
no
␈↓further at this time.
␈↓Simple␈α
devices␈α∞such␈α
as␈α∞vices␈α
or␈α∞tools␈α
have␈α
their␈α∞own␈α
keyword␈α∞syntax␈α
and␈α∞are␈α
controlled␈α∞by␈α
the
␈↓OPERATE statement. In this case new routines would need to be added.
␈↓␈↓∧9.4 FINE CONTROL␈↓
␈↓Interactive␈α
control␈α
of␈α
the␈α
arm␈αhas␈α
to␈α
date␈α
been␈α
limited;␈αwe␈α
can␈α
output␈α
joint␈α
torque␈α
and␈αmonitor
␈↓joint␈α∞position,␈α∞and␈α∞have␈α
two␈α∞binary␈α∞touch␈α∞sensors␈α
inside␈α∞the␈α∞fingers.␈α∞Force-sensing␈α∞elements␈α
are
␈↓being␈α∞developed␈α∞for␈α∂the␈α∞hand␈α∞and␈α∞we␈α∂are␈α∞interested␈α∞in␈α∞more␈α∂powerful␈α∞touch␈α∞sensors;␈α∂when␈α∞we
␈↓have␈αgained␈αexperience␈αwith␈αthese␈αdevices␈αwe␈αwill␈αextend␈αthe␈αlanguage␈αto␈αfacilitate␈αtheir␈αuse.␈αThe
␈↓present␈αversion␈αof␈α
the␈αlanguage␈αreflects␈αthose␈α
things␈αwhich␈αwe␈αhave␈α
verified␈αin␈αpractice␈α
and␈αfeel
␈↓will move development in the right direction.
␈↓␈↓∧9.5 COLLISION AVOIDING␈↓
␈↓Since␈α∂the␈α∂available␈α⊂collision␈α∂avoiders␈α∂are␈α∂quite␈α⊂slow,␈α∂the␈α∂initial␈α∂system␈α⊂relies␈α∂upon␈α∂the␈α⊂user␈α∂to
␈↓provide␈α
her␈αown␈α
collision␈α
avoiding␈αin␈α
the␈α
form␈αof␈α
VIAs␈α
and␈αDEPROACHes.␈α
When␈αfast␈α
collision
␈↓avoiders become available they can be meaningfully included in the system.
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α
␈↓
aPage 87
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α*␈↓∧CHAPTER 10␈↓
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αλ␈↓¬CONCLUSION␈↓
␈↓Some␈αof␈α
what␈αhas␈α
been␈αdescribed␈αin␈α
this␈αpaper␈α
already␈αexists␈αin␈α
running␈αform;␈α
some␈αhas␈αnot␈α
even
␈↓been␈αcoded.␈α As␈αwe␈αcontinue␈αour␈αimplementation␈αof␈αHAL,␈αwe␈αwill␈αno␈αdoubt␈αdiscover␈αthat␈αsome␈αof
␈↓the␈α∞features␈α∞documented␈α∞here␈α∞have␈α∞little␈α∞use,␈α∂or␈α∞are␈α∞better␈α∞handled␈α∞some␈α∞other␈α∞way,␈α∞or␈α∂are␈α∞too
␈↓difficult to implement. We will also discover new features that seem reasonable to include.
␈↓Our␈α
current␈α∞hopes␈α
are␈α∞to␈α
have␈α∞at␈α
least␈α
a␈α∞partial␈α
version␈α∞of␈α
HAL␈α∞operative␈α
by␈α∞December,␈α
1974,
␈↓and to have most of the features documented here available by June, 1975.
␈↓We␈α
would␈α
like␈αto␈α
urge␈α
all␈α
readers␈αof␈α
this␈α
report␈αto␈α
inform␈α
us␈α
of␈αall␈α
the␈α
shortcomings␈α
which␈αour
␈↓design␈α
might␈α∞offer;␈α
in␈α
a␈α∞sense,␈α
we␈α
have␈α∞been␈α
so␈α∞close␈α
to␈α
it␈α∞for␈α
so␈α
long␈α∞that␈α
we␈α∞undoubtedly␈α
are
␈↓blind to some major defects.
␈↓Page 88␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α ␈↓ H
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α+␈↓∧CHAPTER 11␈↓
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α1␈↓¬BIBLIOGRAPHY␈↓
␈↓[Baumgart]␈α↔B.␈α↔Baumgart,␈α↔␈↓βGEOMED␈α↔-␈α⊗A␈α↔Geometric␈α↔Editor␈↓␈α↔Stanford␈α↔Artificial␈α⊗Intelligence
␈↓␈↓ αHLaboratory Operating Note 68, May 1972.
␈↓[Bejczy]␈α∂A.␈α∂K.␈α∂Bejczy,␈α∂␈↓βRobot␈α∂Arm␈α∂Dynamics␈α∂and␈α∂Control,␈↓␈α∂Jet␈α∂Propulsion␈α∂Laboratory,␈α∂Technical
␈↓␈↓ αHMemorandum 33-669, February, 1974.
␈↓[Bolles]␈αR.␈α
C.␈αBolles,␈α
␈↓βThe␈αUse␈α
of␈αSensory␈αFeedback␈α
in␈αa␈α
Programmable␈αAssembly␈α
System␈↓,␈αStanford
␈↓␈↓ αHArtificial Intelligence Project, Memo No. 220, October 1973.
␈↓[DEC]␈α∃Digital␈α∃Equipment␈α∀Corporation,␈α∃␈↓βPDP␈α∃11/45␈α∀Processor␈α∃Handbook,␈↓␈α∃Digital␈α∀Equipment
␈↓␈↓ αHCorporation, 1974.
␈↓[Ernst]␈α∃H.␈α∃A.␈α∃Ernst,␈α∃"MH-1,␈α∀A␈α∃Computer-Operated␈α∃Mechanical␈α∃Hand,"␈α∃1962␈α∃Spring␈α∀Joint
␈↓␈↓ αHComputer Conference, San Francisco, May 1-3, AFIPS Proceedings, pp. 39-51.
␈↓[Feldman 71a]␈α
J.␈α∞A.␈α
Feldman,␈α
R.␈α∞F.␈α
Sproull,␈α∞␈↓βSystem␈α
Support␈α
for␈α∞the␈α
Stanford␈α∞Hand-Eye␈α
System,␈↓
␈↓␈↓ αHSecond␈αInternational␈αJoint␈αConference␈αon␈αArtificial␈αIntelligence,␈αLondon,␈αSeptember␈α
1-3,
␈↓␈↓ αH1971.
␈↓[Feldman 71b]␈α∞J.␈α∞Feldman,␈α∞K.␈α∞Pingle,␈α∞T.␈α∞Binford,␈α∞G.␈α
Falk,␈α∞A.␈α∞Kay,␈α∞R.␈α∞Paul,␈α∞R.␈α∞Sproull,␈α∞and␈α
J.
␈↓␈↓ αHTennenbaum,␈α
␈↓βThe␈αUse␈α
of␈α
Vision␈αand␈α
Manipulation␈α
to␈αSolve␈α
the␈α
`Instant␈αInsanity'␈α
Puzzle,␈↓
␈↓␈↓ αHSecond␈αInternational␈αJoint␈αConference␈αon␈αArtificial␈αIntelligence,␈αLondon,␈αSeptember␈α
1-3,
␈↓␈↓ αH1971.
␈↓[Feldman 72]␈α∞J.␈α∂Feldman,␈α∞J.␈α∂Low,␈α∞R.␈α∂Taylor,␈α∞D.␈α∂Swinehart,␈α∞"Recent␈α∂Developments␈α∞in␈α∂SAIL,␈α∞an
␈↓␈↓ αHAlgol␈α∀Based␈α∀Language␈α∀for␈α∀Artificial␈α∀Intelligence,"␈α∀Proceedings␈α∀of␈α∀the␈α∀FJCC,␈α∀1972
␈↓␈↓ αHpp.1193-1202.
␈↓[Gill]␈α_A.␈α→Gill,␈α_␈↓βVisual␈α_Feedback␈α→and␈α_Related␈α_Problems␈α→in␈α_Computer␈α→Controlled␈α_Hand-Eye
␈↓β␈↓ αHCoordination,␈↓ Stanford Artificial Intelligence Project, Memo No. 178, October 1972.
␈↓[Goto]␈α
T.␈α
Goto,␈α
␈↓βet␈α
al.␈↓,␈α
"Compact␈α∞Packaging␈α
by␈α
Robot␈α
With␈α
Tactile␈α
Sensors,"␈α
Proceedings␈α∞of␈α
the
␈↓␈↓ αHSecond International Symposium on Industrial Robots, pp. 149-159, May 1972.
␈↓[IITRI] ␈↓βProceedings of the 2nd. International Symposium on Industrial Robots␈↓, May 1972.
␈↓[Inoue]␈α∪H.␈α∀Inoue,␈α∪"Computer␈α∀Controlled␈α∪Bilateral␈α∀Manipulator,"␈α∪Bulletin␈α∀of␈α∪the␈α∀JSME,␈α∪pp.
␈↓␈↓ αH199-207, Vol. 14, No. 69, 1971.
␈↓[Kahn]␈α∀M.␈α∀E.␈α∀Kahn,␈α∀␈↓βThe␈α∪Near-Minimum-Time␈α∀Control␈α∀of␈α∀Open-Loop␈α∀Articulated␈α∪Kinematic
␈↓β␈↓ αHChains␈↓, Stanford Artificial Intelligence Project, Memo No. 106, December 1969.
␈↓[Leslie]␈α_W.␈α_H.␈α_P.␈α_Leslie,␈α↔ed.␈α_␈↓βNumerical␈α_Control␈α_Programming␈α_Languages␈↓,␈α↔North-Holland
␈↓␈↓ αHPublishing Company, London, 1972.
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α
␈↓
aPage 89
␈↓[Lindbom]␈α
T.␈α
H.␈α∞Lindbom,␈α
"Today's␈α
Robots␈α∞at␈α
Work␈α
in␈α
Industry:␈α∞Matching␈α
the␈α
Robot␈α∞and␈α
the
␈↓␈↓ αHJob,"␈αProceedings␈αof␈αthe␈α2nd.␈αInternational␈αSymposium␈αon␈αIndustrial␈αRobots,␈αMay␈α1972,
␈↓␈↓ αHpp.129-148
␈↓[Nevins 73]␈α∩J.␈α∩L.␈α∩Nevins,␈α⊃D.␈α∩E.␈α∩Whitney,␈α∩S.␈α⊃N.␈α∩Simunovic,␈α∩␈↓βSystem␈α∩Architecture␈α∩for␈α⊃Assembly
␈↓β␈↓ αHMachines␈↓,␈α⊃The␈α⊂Charles␈α⊃Stark␈α⊃Draper␈α⊂Laboratory,␈α⊃Inc.,␈α⊂Memo␈α⊃No.␈α⊃R-764,␈α⊂November
␈↓␈↓ αH1973.
␈↓[Nevins 74]␈α∩J.␈α⊃L.␈α∩Nevins,␈α⊃D.␈α∩E.␈α⊃Whitney,␈α∩␈↓βet␈α⊃al.␈↓,␈α∩␈↓βExploratory␈α⊃Research␈α∩in␈α∩Industrial␈α⊃Modular
␈↓β␈↓ αHAssembly␈↓, The Charles Stark Draper Laboratory, Inc., Memo No. R-800, March 1974.
␈↓[Paul]␈α∞R.␈α∞P.␈α∞Paul,␈α∞␈↓βModelling,Trajectory␈α∞Calculation␈α∞and␈α∞Servoing␈α∞of␈α∞a␈α∞Computer␈α∞Controlled␈α∞Arm␈↓,
␈↓␈↓ αHStanford Artificial Intelligence Project, Memo No. 177, March 1973.
␈↓[Pieper]␈α∃D.␈α∃L.␈α∃Pieper,␈α∃␈↓βThe␈α∃Kinematics␈α∃of␈α∃Manipulators␈α∃Under␈α∃Computer␈α∃Control␈↓,␈α∃Stanford
␈↓␈↓ αHArtificial Intelligence Project, Memo No. 72, October 1968.
␈↓[Roberts 63]␈α⊂L.␈α⊂G.␈α∂Roberts,␈α⊂␈↓βMachine␈α⊂Perception␈α∂of␈α⊂Three-Dimensional␈α⊂Solids␈↓,␈α⊂Technical␈α∂Report
␈↓␈↓ αHNo. 315, Lincoln Laboratory, Massachusetts Institute of Technology, May 1963.
␈↓[Roberts 65]␈α⊗L.␈α⊗G.␈α⊗Roberts,␈α⊗␈↓βHomogeneous␈α⊗Matrix␈α⊗Representation␈α⊗and␈α⊗Manipulation␈α↔of␈α⊗N-
␈↓β␈↓ αHDimensional␈αConstructs␈↓,␈αDocument␈αMS1045,␈αLincoln␈αLaboratory,␈αMassachusetts␈αInstitute
␈↓␈↓ αHof Technology, May 1965.
␈↓[Rosen]␈α
C␈α
Rosen,␈α
␈↓βet.␈α
al.,␈α
Exploratory␈α
Research␈α
in␈α
Advanced␈α
Automation,␈↓␈α
Stanford␈α
Research␈α
Institute
␈↓␈↓ αHReport, December 1973.
␈↓[Scheinman]␈αV.␈α
D.␈αScheinman,␈α
␈↓βDesign␈αof␈α
a␈αComputer␈α
Manipulator␈↓,␈αStanford␈αArtificial␈α
Intelligence
␈↓␈↓ αHProject, Memo No. 92, June 1969.
␈↓[Swinehart]␈αD.␈αSwinehart,␈αR.␈αSproull,␈α
␈↓βSail␈↓,␈αStanford␈αArtificial␈αIntelligence␈αProject,␈α
Memo␈αNo. 57,
␈↓␈↓ αHNovember 1969.
␈↓[VanLehn]␈α
K␈α
VanLehn,␈α
ed.␈α
␈↓βSail␈α
User's␈α
Manual␈↓,␈α
Stanford␈α
Artificial␈α
Intelligence␈α
Project,␈α
Memo
␈↓␈↓ αHNo. 204, July 1973.
␈↓[Whitney]␈α↔D.␈α↔E.␈α↔Whitney,␈α↔"Resolved␈α↔Motion␈α↔Rate␈α↔Control␈α↔of␈α↔Manipulators␈α↔and␈α⊗Human
␈↓␈↓ αHProstheses,"␈α
IEEE␈α
Transaction␈α
on␈α
Man-Machine␈αSystems,␈α
pp.␈α
47-53,␈α
Vol␈α
MMS-10,␈αNo.
␈↓␈↓ αH2, June 1969.
␈↓[Wickman]␈α
W.␈α
M.␈α
Wickman,␈α
␈↓βUse␈α
of␈α
Optical␈α
Feedback␈α
in␈α
the␈α
Computer␈α
Control␈α
of␈α
an␈αArm,␈↓␈α
Stanford
␈↓␈↓ αHArtificial Intelligence Project, Memo No. 56, August 1967.
␈↓Page 90␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ H
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α+␈↓∧APPENDIX I␈↓
␈↓␈α?␈α?␈α?␈α?␈α?␈α8␈↓¬PROGRAMMING EXAMPLES␈↓
␈↓␈↓∧I.1 BOLTING A BRACKET ONTO A BEAM␈↓
␈↓This␈αis␈αintended␈α
to␈αbe␈αa␈α
series␈αof␈αprogressively␈αmore␈α
complex␈αexamples␈αwhich␈α
demonstrate␈αsome
␈↓of␈αthe␈αfeatures␈αin␈αHAL,␈αincluding␈αattachment,␈αcontrol␈αstructure,␈αmacros,␈αand␈αlibrary␈αroutines.␈α All
␈↓of␈α
the␈α
examples␈α
have␈α
essentially␈αthe␈α
same␈α
goal:␈α
bolt␈α
a␈αBRACKET␈α
to␈α
a␈α
beam.␈α
Each␈αexample␈α
takes
␈↓into account more possibilities or contains a different way of expressing the same thing.
␈↓The initial and final attachment structures are:
␈↓ INITIAL: TABLE FINAL: TABLE
␈↓ YELLOW YELLOW
␈↓ BLUE BLUE
␈↓ BRACKET BEAM
␈↓ BRACKET_HOLE BEAM_HOLE
␈↓ BRACKET_GRASP BRACKET
␈↓ BOLT BRACKET_HOLE
␈↓ BEAM BRACKET_GRASP
␈↓ BEAM_HOLE BOLT
␈↓The␈αinitial␈αstructure␈αcan␈αbe␈αcreated␈αby␈α
the␈αfollowing␈αdeclarations.␈α There␈αwill␈αeventually␈αbe␈αa␈α
way
␈↓of␈α∞interacting␈α∞with␈α∞the␈α∂HAL␈α∞supervisor␈α∞to␈α∞initialize␈α∞frame␈α∂values,␈α∞either␈α∞by␈α∞reading␈α∂an␈α∞"object
␈↓description"␈α
(which␈α∞might␈α
have␈α
come␈α∞from␈α
the␈α
designer)␈α∞or␈α
by␈α
manually␈α∞positioning␈α
the␈α∞arm␈α
at
␈↓the desired positions. See Figure 1.1.
␈↓UNITS CENTIMETERS, BOLLES, DEGREES, SECONDS;
␈↓␈↓ αλ␈↓βCOMMENT␈αthis␈α
sets␈αthe␈αdefaults␈α
to␈αthe␈αindicated␈α
units.␈α Notice␈αthat␈α
BOLLES␈αangles␈αmean␈α
a
␈↓β␈↓ αλrotation␈αabout␈α
the␈αX␈αAxis,␈α
followed␈αby␈αa␈α
rotation␈αabout␈αthe␈α
original␈αY␈αaxis,␈α
followed␈αby␈α
a␈αfinal
␈↓β␈↓ αλrotation about the original Z axis;
␈↓FRAME BEAM, BEAM_HOLE;
␈↓FRAME BRACKET, BRACKET_HOLE, BRACKET_GRASP;
␈↓FRAME BOLT;
␈↓BEAM ← [(30, 24.2, 0) : (0, 0, 90)];
␈↓␈↓ αλ␈↓βCOMMENT␈αthis␈α
is␈αnot␈α
attached␈αto␈α
anything␈αinitially.␈α
Thus␈αthe␈α
default␈αDEPROACH␈α
is␈αthe
␈↓β␈↓ αλTABLE's DEPROACH which is: [(0, 0, 10) | (0, 0, 0)];
␈↓BEAM_HOLE ← BEAM * [(5.1, 0, 15) : (-90, 0, 0)];
␈↓␈↓ αλ␈↓βCOMMENT␈α↔[(5.1,␈α⊗0,␈α↔15):(90,␈α↔0,␈α⊗90)]␈α↔is␈α⊗the␈α↔relative␈α↔transform␈α⊗from␈α↔BEAM␈α↔to␈α⊗the
␈↓β␈↓ αλBEAM_HOLE.␈α Another␈αway␈αof␈αlooking␈αat␈αthis␈αis␈αthat␈αwithin␈αthe␈αBEAM's␈αframe␈αof␈αreference,
␈↓β␈↓ αλthe␈α
BEAM_HOLE␈α
is␈α
at␈α
[(5.1,␈α
0,␈α
15):(90,␈α
0,␈α
90)].␈α
The␈α
premultiplication␈α
by␈αBEAM␈α
transforms
␈↓I.1␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α↓BOLTING A BRACKET␈↓
aPage 91
␈↓β␈↓ αλthis␈αrelative␈αlocation␈αout␈αto␈αthe␈α
corresponding␈αposition␈α(in␈αTABLE␈αcoordinates)␈αwith␈α
respect␈αto
␈↓β␈↓ αλthe current location of BEAM;
␈↓ATTACH BEAM_HOLE TO BEAM;
␈↓ASSERT FACT (DEPROACH BEAM_HOLE [(0, 0, -3)|(0, 0, 0)]);
␈↓␈↓ αλ␈↓βCOMMENT␈α∃this␈α∃sets␈α∀up␈α∃a␈α∃DEPROACH␈α∃of␈α∀-3␈α∃centimeters␈α∃in␈α∀the␈α∃Z␈α∃direction␈α∃of␈α∀the
␈↓β␈↓ αλBEAM_HOLE's coordinate system;
␈↓BRACKET ← [(20, 40, 0) : (0, 0, 90)];
␈↓BRACKET_HOLE ← BRACKET * [(5.1, 2, 0) : (180, 0, 0)];
␈↓ATTACH BRACKET_HOLE TO BRACKET;
␈↓BRACKET_GRASP ← BRACKET * [(0, 1.5, 5) : (180, 0, 0)];
␈↓ATTACH BRACKET_GRASP TO BRACKET RIGIDLY;
␈↓␈↓ αλ␈↓βCOMMENT␈αnotice␈αthat␈αchanging␈αBRACKET_GRASP␈αwill␈αautomatically␈αchange␈αBRACKET,
␈↓β␈↓ αλwhich␈α
in␈α
turn␈α
will␈αautomatically␈α
change␈α
BRACKET_HOLE.␈α
This␈αis␈α
very␈α
handy␈α
if␈αthe␈α
position
␈↓β␈↓ αλof the whole `object' is being updated by one grasping position (ie. BRACKET_GRASP);
␈↓BOLT ← [(30, 60, 5) : (180, 0, 90)];
␈↓␈↓ αλ␈↓βCOMMENT the bolt is assumed to be sticking out of a dispenser;
␈↓␈↓βI.1.1 EXAMPLE ONE␈↓
␈↓The task involves the following steps:
␈↓␈↓ αH(1)␈αPick␈αup␈αthe␈αBRACKET␈αwith␈αthe␈α
YELLOW␈αarm␈αand␈αposition␈αit␈αnext␈αto␈αthe␈α
BEAM
␈↓␈↓ βλso that the holes line up
␈↓␈↓ αH(2)␈αPick␈αup␈αthe␈αbolt␈αwith␈αthe␈αBLUE␈αarm␈αand␈αinsert␈αit␈αin␈αthe␈αhole␈α(in␈αthis␈αexample␈αit␈αis
␈↓␈↓ βλnot screwed in; a later example will use a socket driver to tighten the bolt)
␈↓␈↓ αH(3) Return both arms to park
␈↓The␈αBRACKET␈αis␈αassumed␈αto␈αbe␈α1cm␈αthick␈α,␈αand␈αthe␈αBOLT␈α4cm␈αlong.␈α The␈αfollowing␈αprogram
␈↓is␈αa␈α
straightforward␈αway␈αof␈α
expressing␈αthe␈αmotions␈α
and␈αfeedback␈αnecessary␈α
to␈αcarry␈αout␈α
the␈αtask.
␈↓Everything␈α∞is␈α∞assumed␈α∞to␈α
be␈α∞in␈α∞the␈α∞right␈α
place␈α∞and␈α∞every␈α∞motion␈α
is␈α∞assumed␈α∞to␈α∞accomplish␈α
the
␈↓desired␈α
effect.␈α
For␈α
example,␈α
this␈α
program␈α
assumes␈α
that␈α
the␈α
arm␈α
is␈α
accurate␈α
enough␈α
to␈α∞align␈α
the
␈↓BRACKET_HOLE␈αwith␈αthe␈αBEAM_HOLE␈αand␈αto␈αinsert␈αthe␈αBOLT␈αwithout␈αhitting␈αthe␈αside␈αor
␈↓binding. Later examples will take this type of error into account.
␈↓OPERATE YFINGERS WITH OPENING=1;
␈↓MOVE YELLOW TO BRACKET_GRASP;
␈↓␈↓ αλ␈↓βCOMMENT␈α⊂since␈α⊂BRACKET_GRASP␈α⊂does␈α∂not␈α⊂have␈α⊂a␈α⊂DEPROACH␈α⊂explicitly␈α∂associated
␈↓β␈↓ αλwith␈α∩it,␈α∩the␈α∩compiler␈α∩checks␈α⊃to␈α∩see␈α∩if␈α∩it␈α∩is␈α⊃attached␈α∩to␈α∩anything.␈α∩ It␈α∩is,␈α∩BRACKET.␈α⊃ But
␈↓β␈↓ αλBRACKET␈αdoes␈αnot␈αhave␈αa␈αDEPROACH␈αassociated␈αwith␈αit␈αeither.␈α Is␈αit␈αattached␈αto␈αanything?
␈↓β␈↓ αλNo.␈α
Therefore,␈αby␈α
default␈αthe␈α
compiler␈α
uses␈αthe␈α
TABLE's␈αDEPROACH␈α
(ie.␈α[(0,␈α
0,␈α
10):(0,␈α0,
␈↓β␈↓ αλ0)] ) as the approach for BRACKET_GRASP;
␈↓CENTER YELLOW;
␈↓␈↓ αλ␈↓βCOMMENT this closes the fingers until they grab something;
␈↓BRACKET_GRASP ← YELLOW;
␈↓Page 92␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ ∪I.1.1
␈↓␈↓ αλ␈↓βCOMMENT␈α
since␈α∞BRACKET_GRASP␈α
is␈α∞RIGIDLY␈α
attached␈α∞to␈α
BRACKET,␈α∞this␈α
statement
␈↓β␈↓ αλupdates␈αBRACKET␈αand␈αhence␈αanything␈αattached␈αto␈αBRACKET␈α(eg.␈αBRACKET_HOLE).␈α In
␈↓β␈↓ αλeffect,␈αthe␈αassumption␈αbeing␈αmade␈αis␈αthat␈αthe␈αposition␈αof␈αthe␈αwhole␈α`object'␈α(ie.␈αthe␈αBRACKET)
␈↓β␈↓ αλcan␈α∂be␈α⊂updated␈α∂by␈α⊂locating␈α∂BRACKET_GRASP.␈α⊂ In␈α∂the␈α∂usage␈α⊂above␈α∂the␈α⊂arm␈α∂moves␈α⊂to␈α∂the
␈↓β␈↓ αλplanning␈αposition␈α
for␈αBRACKET_GRASP␈αand␈α
then␈αcenters␈αitself␈α
about␈αthe␈αobject␈α
between␈αits
␈↓β␈↓ αλfingers.␈α
Notice␈α∞that␈α
the␈α∞final␈α
position␈α∞of␈α
the␈α
arm␈α∞may␈α
very␈α∞well␈α
not␈α∞be␈α
BRACKET_GRASP
␈↓β␈↓ αλ(because␈α∞of␈α
the␈α∞accommodation␈α
within␈α∞the␈α∞centering).␈α
Therefore,␈α∞the␈α
BRACKET␈α∞might␈α∞not␈α
be
␈↓β␈↓ αλwhere␈αit␈αwas␈α
planned␈αto␈αbe.␈α
This␈αdiscrepancy␈αbetween␈α
the␈αplanned␈αworld␈α
and␈αthe␈α`actual'␈α
world
␈↓β␈↓ αλhas␈αto␈αbe␈αreconciled.␈α The␈α
simplest␈αassumption␈α(and␈αthe␈αassumption␈α
being␈αused␈αhere)␈αis␈αthat␈α
the
␈↓β␈↓ αλonly␈αdifference␈αbetween␈αthe␈αplanned␈αlocation␈αand␈αthe␈αactual␈αis␈αthat␈αthe␈α`whole'␈αBRACKET␈αhas
␈↓β␈↓ αλbeen␈α∞moved␈α
along␈α∞the␈α∞line␈α
between␈α∞the␈α∞fingers␈α
so␈α∞that␈α∞BRACKET_GRASP␈α
is␈α∞where␈α∞the␈α
arm
␈↓β␈↓ αλfound␈α∞it.␈α
More␈α∞complicated␈α∞updating␈α
could␈α∞be␈α
done␈α∞by␈α∞visually␈α
locating␈α∞the␈α∞BRACKET␈α
and
␈↓β␈↓ αλreseting␈α
BRACKET␈α
or␈α∞by␈α
feeling␈α
the␈α∞BRACKET␈α
two␈α
or␈α∞three␈α
times,␈α
combining␈α∞the␈α
resulting
␈↓β␈↓ αλlocations␈αinto␈αa␈α
new␈αestimate␈αof␈α
BRACKET's␈αlocation,␈αand␈α
reseting␈αBRACKET.␈α Notice␈αthat␈α
if
␈↓β␈↓ αλthe␈αCENTER␈αmoved␈αthe␈αarm␈αaway␈αfrom␈αthe␈αplanned␈αlocation␈αand␈αno␈αupdating␈αwere␈αdone,␈αthe
␈↓β␈↓ αλATTACH␈α
statement␈α
which␈α
follows␈αwould␈α
attach␈α
the␈α
BRACKET␈α
to␈αthe␈α
YELLOW␈α
arm␈α
in␈αsuch␈α
a
␈↓β␈↓ αλway␈α
that␈αthe␈α
BRACKET␈αwas␈α
assumed␈αto␈α
be␈αat␈α
its␈αplanning␈α
position␈α(which␈α
would␈α
be␈αwrong).
␈↓β␈↓ αλThe subsequent move to the BEAM_HOLE would also be off by the same amount.;
␈↓ATTACH BRACKET TO YELLOW;
␈↓MOVE BRACKET_HOLE TO BEAM_HOLE;
␈↓␈↓ αλ␈↓βCOMMENT␈αnotice␈αthat␈αthe␈αBRACKET␈αapproaches␈αthe␈αBEAM␈αfrom␈αthe␈αside␈α(not␈αfrom␈αabove)
␈↓β␈↓ αλbecause␈α∞of␈α∂the␈α∞DEPROACH␈α∂set␈α∞up␈α∂for␈α∞BEAM_HOLE.␈α∂ In␈α∞this␈α∂example␈α∞the␈α∂BRACKET␈α∞is
␈↓β␈↓ αλassumed to go right next to the BEAM;
␈↓β␈↓ αλThis␈αMOVE␈αis␈αa␈αmove␈αfor␈αthe␈αYELLOW␈α
arm␈α(because␈αthe␈αBRACKET␈αis␈αattached␈αto␈αit).␈α
From
␈↓β␈↓ αλthe␈α∪definition␈α∪of␈α∪attachment␈α∪this␈α∪means␈α∪that␈α∪anything␈α∪attached␈α∪to␈α∪the␈α∪YELLOW␈α∪arm␈α∩is
␈↓β␈↓ αλautomatically␈αmoved.␈α
Thus,␈αBRACKET,␈α
BRACKET_HOLE,␈αand␈α
BRACKET_GRASP␈αare␈α
all
␈↓β␈↓ αλupdated.␈α∂ The␈α∂fact␈α∂that␈α∂the␈α∂move␈α∞was␈α∂specified␈α∂by␈α∂mentioning␈α∂BRACKET_HOLE␈α∂(and␈α∞not
␈↓β␈↓ αλYELLOW)␈α⊂does␈α∂not␈α⊂change␈α∂the␈α⊂automatic␈α⊂updating␈α∂within␈α⊂the␈α∂graph␈α⊂structure.␈α⊂ Notice,␈α∂in
␈↓β␈↓ αλparticular, that this is quite different from:
␈↓β␈↓ αλ ATTACH BRACKET TO YELLOW
␈↓β␈↓ αλ BRACKET_HOLE ← BEAM_HOLE
␈↓β␈↓ αλThis␈α⊗would␈α↔change␈α⊗the␈α⊗value␈α↔of␈α⊗BRACKET_HOLE␈α⊗and␈α↔the␈α⊗relative␈α↔position␈α⊗between
␈↓β␈↓ αλBRACKET and BRACKET_HOLE, but leave YELLOW and BRACKET unchanged.
␈↓OPERATE BFINGERS WITH OPENING=1;
␈↓MOVE BLUE TO BOLT;
␈↓␈↓ αλ␈↓βCOMMENT the TABLE's approach is used since the BOLT is not attached to anything;
␈↓CENTER BLUE;
␈↓BOLT ← BLUE;
␈↓␈↓ αλ␈↓βCOMMENT This insures that the latest value of BOLT is used in the attach command below;
␈↓ATTACH BOLT TO BLUE;
␈↓MOVE BOLT TO BEAM_HOLE + (0, 0, -5.3) WRT BEAM_HOLE;
␈↓␈↓ αλ␈↓βCOMMENT␈α∞this␈α∞should␈α∞position␈α
the␈α∞bolt␈α∞.3␈α∞centimeters␈α∞off␈α
of␈α∞the␈α∞BRACKET.␈α∞ That␈α∞is,␈α
the
␈↓β␈↓ αλYELLOW␈α→arm␈α_is␈α→now␈α→holding␈α_the␈α→BRACKET␈α_right␈α→next␈α→to␈α_the␈α→BEAM␈α→(with␈α_the
␈↓β␈↓ αλBRACKET_HOLE␈αaligned␈αwith␈αthe␈αBEAM_HOLE)␈α
and␈αthe␈αBlue␈αarm␈αis␈αholding␈α
the␈αBOLT
␈↓I.1.1␈α?␈α?␈α?␈α?␈α?␈α?␈α0BOLTING A BRACKET␈↓
aPage 93
␈↓β␈↓ αλ5.3␈α
centimeters␈α
away␈α
from␈α
the␈αBRACKET_HOLE␈α
(which␈α
is␈α
equivalent␈α
with␈αBEAM_HOLE).
␈↓β␈↓ αλBut␈α
remember␈α
that␈α
the␈α
BRACKET␈α
is␈α
1␈α
centimeter␈α
thick␈α
and␈α
the␈α
BOLT␈α
is␈α
4␈α∞centimeters␈α
long,
␈↓β␈↓ αλthus␈α∪the␈α∪tip␈α∪of␈α∪the␈α∪BOLT␈α∪is␈α∪1.3␈α∪centimeters␈α∪from␈α∪the␈α∪BEAM_HOLE␈α∪(or␈α∪.3␈α∪off␈α∪of␈α∩the
␈↓β␈↓ αλBRACKET).
␈↓β␈↓ αλThe following is a list of rules governing automatic DEPARTUREs and
␈↓β␈↓ αHAPPROACHes:
␈↓β␈↓ αH(1) If the destination contains `⊗', no automatic departure or approach is used.
␈↓β␈↓ αH(2)␈αIf␈αthe␈αdestination␈α
contains␈αonly␈αone␈αframe␈α
name,␈αan␈αautomatic␈αapproach␈α
is␈αcomputed.
␈↓β␈↓ βλThis␈αis␈αdone␈α
by␈αchaining␈αup␈α
the␈αattach␈αstructure␈α
(beginning␈αat␈αthe␈α
frame␈αmentioned
␈↓β␈↓ βλin␈α
the␈α
destination)␈α
until␈α
a␈α
DEPROACH␈α
is␈αfound␈α
for␈α
one␈α
of␈α
the␈α
frames␈α
or␈α
until␈αall␈α
of
␈↓β␈↓ βλthe␈αframes␈αreachable␈αfrom␈αthe␈αstarting␈αframe␈αhave␈αbeen␈αconsidered;␈αat␈αthat␈αpoint␈αuse
␈↓β␈↓ βλthe TABLE's DEPROACH, [(0,0,10):(0,0,0)].
␈↓β␈↓ αH(3) If the destination contains two or more frame names no automatic approach is used.
␈↓β␈↓ αH(4)␈α
In␈α
cases␈α
(2)␈α
and␈α
(3)␈α
above,␈α
an␈α
automatic␈α
departure␈α
is␈α
computed␈α
based␈α
upon␈αthe␈α
current
␈↓β␈↓ βλposition␈αof␈αthe␈αarm␈αand␈αhow␈αit␈αgot␈αthere.␈α If␈αits␈αcurrent␈αposition␈αwas␈αspecified␈αusing
␈↓β␈↓ βλonly␈αone␈αframe␈αname,␈α
that␈αframes␈αautomatic␈αdeproach␈α
will␈αbe␈αused␈αfor␈α
the␈αdeparture
␈↓β␈↓ βλwhen␈αthe␈αarm␈αmoves␈αaway,␈αunless␈αan␈αobject␈αis␈αattached␈αto␈αthe␈αarm␈αat␈αthis␈αposition.␈α If
␈↓β␈↓ βλan␈αobject␈α
is␈αdetached␈α
from␈αsomething␈α
(say␈αX)␈α
and␈αattached␈α
to␈αthe␈α
arm␈αin␈α
its␈αcurrent
␈↓β␈↓ βλposition,␈α⊃use␈α⊃X's␈α⊃DEPROACH␈α⊃for␈α⊂the␈α⊃automatic␈α⊃departure␈α⊃when␈α⊃the␈α⊃arm␈α⊂moves
␈↓β␈↓ βλaway.␈α
This␈α
was␈α
included␈αso␈α
the␈α
automatic␈α
departure␈α
does␈αthe␈α
`right'␈α
thing␈α
as␈αoften␈α
as
␈↓β␈↓ βλpossible.
␈↓β␈↓ αH(5)␈α∀The␈α∀automatic␈α∀approaches␈α∀and␈α∀departures␈α∀can␈α∀always␈α∀be␈α∀overridden␈α∀by␈α∪explicit
␈↓β␈↓ βλUSING APPROACH = ... or USING DEPARTURE = ... clauses with a MOVE;
␈↓MOVE BLUE TO ⊗ + (0, 0, 5) WRT BEAM_HOLE
␈↓ USING FREE=(X WRT BLUE), FREE=(Y WRT BLUE)
␈↓ ON FORCE(Z WRT BLUE) > 60 DO STOP BLUE;
␈↓␈↓ αλ␈↓βCOMMENT␈αthe␈αarm␈αstops␈αwhen␈αthe␈αbolt␈αhits␈αthe␈αbottom␈αof␈αthe␈αhole.␈α No␈αdeproach␈αor␈αapproach
␈↓β␈↓ αλis used because the destination involves the "⊗";
␈↓OPERATE YFINGERS WITH OPENING = 1;
␈↓DETACH BRACKET FROM YELLOW;
␈↓ATTACH BRACKET TO BEAM;
␈↓MOVE YELLOW TO YPARK;
␈↓OPERATE BFINGERS WITH OPENING = 1;
␈↓DETACH BOLT FROM BLUE;
␈↓ATTACH BOLT TO BEAM;
␈↓MOVE BLUE TO BPARK;
␈↓WRITE("FINISHED");
␈↓Page 94␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ ∪I.1.2
␈↓␈↓βI.1.2 EXAMPLE TWO␈↓
␈↓This␈α⊂version␈α⊂adds␈α⊂a␈α⊃number␈α⊂of␈α⊂checks␈α⊂(and␈α⊃some␈α⊂automatic␈α⊂recoveries)␈α⊂for␈α⊃possible␈α⊂run-time
␈↓errors␈α
such␈α∞as␈α
not␈α∞inserting␈α
the␈α
BOLT.␈α∞ It␈α
also␈α∞utilizes␈α
the␈α
COBEGIN␈α∞-␈α
COEND␈α∞capability␈α
to
␈↓describe␈αsimultaneous␈α(unordered,␈αindependent)␈αactions.␈α Thus,␈αthe␈αYellow␈αarm␈αcan␈αbe␈αpicking␈αup
␈↓the␈αBRACKET␈αand␈αpositioning␈αit␈αnear␈αthe␈αBEAM␈αwhile␈αthe␈αBlue␈αarm␈αis␈αpicking␈αup␈αthe␈αBOLT.
␈↓Collision avoidance is currently the responsibility of the user.
␈↓COBEGIN "POSITIONING"
␈↓ BEGIN "PICK UP BRACKET BY YELLOW"
␈↓ OPERATE YFINGERS WITH OPENING=1;
␈↓ MOVE YELLOW TO BRACKET_GRASP;
␈↓ CENTER YELLOW
␈↓ ON OPENING = 0 DO
␈↓ BEGIN "MISSED BRACKET"
␈↓ STOP YELLOW;
␈↓ SCALAR FLAG;
␈↓ OPERATE YFINGERS WITH OPENING=2;
␈↓ MOVE YELLOW
␈↓ TO BRACKET_GRASP * THE_DEPARTURE(BRACKET_GRASP)
␈↓ USING APPROACH = NIL, DEPARTURE = NIL;
␈↓␈↓ ∧λ␈↓βCOMMENT␈α⊂this␈α⊂should␈α⊂safely␈α⊂move␈α⊂the␈α⊂arm␈α⊂away␈α⊂so␈α⊂the␈α⊂operator␈α⊂can
␈↓β␈↓ ∧λeasily␈α⊂insert␈α⊂the␈α∂missing␈α⊂BRACKET.␈α⊂ It␈α∂moves␈α⊂the␈α⊂arm␈α∂back␈α⊂out␈α⊂to␈α∂the
␈↓β␈↓ ∧λBRACKET_GRASP's approach point at runtime.
␈↓β␈↓ ∧λCOMMENT␈α∩the␈α∩"THE_DEPARTURE(...)"␈α∩is␈α∩a␈α∩macro␈α∩which␈α∩expands
␈↓β␈↓ ∧λinto␈αa␈α
DEPROACH.␈α This␈α
magic␈αis␈α
described␈αunder␈αthe␈α
COMPILE-TIME
␈↓β␈↓ ∧λvariables␈α
section␈αabove.␈α
More␈αexamples␈α
are␈αgiven␈α
a␈αlittle␈α
later␈αin␈α
this␈αset␈α
of
␈↓β␈↓ ∧λexamples;
␈↓ WRITE("THE BRACKET IS MISSING ... POSITION IT AND TYPE `1'
␈↓ TO TRY AGAIN");
␈↓ READ(FLAG);
␈↓ IF FLAG ␈↓ε≠␈↓ 1 THEN ABORT ("YOU DID NOT TYPE 1");
␈↓␈↓ ∧λ␈↓βCOMMENT␈αthe␈αABORT␈αstops␈αeverything,␈αsaves␈αthe␈αworld,␈αand␈αforces␈αthe
␈↓β␈↓ ∧λoperator␈αto␈αdeal␈αwith␈αthe␈αproblem␈αat␈αsupervisor␈αlevel,␈αpossibly␈αinvestigating
␈↓β␈↓ ∧λthe␈α∞saved␈α
information,␈α∞reinitializing␈α∞the␈α
world␈α∞to␈α
some␈α∞previous␈α∞state␈α
and
␈↓β␈↓ ∧λrestartinc;
␈↓ MOVE YELLOW TO BRACKET_GRASP
␈↓ USING APPROACH=NIL, DEPARTURE=NIL;
␈↓␈↓ ∧λ␈↓βCOMMENT␈αthis␈αresults␈αin␈αa␈α
simple␈αmove␈αwithout␈αa␈αDEPARTURE␈αor␈α
an
␈↓β␈↓ ∧λAPPROACH;
␈↓ CENTER YELLOW
␈↓ ON OPENING=0 DO ABORT("I HAVE TRIED TWICE. I GIVE UP.");
␈↓ END "MISSED BRACKET";
␈↓ ASSERT YELLOW = (BRACKET_GRASP);
␈↓␈↓ αH␈↓βCOMMENT␈α∀this␈α∀tells␈α∀the␈α∃compiler␈α∀that␈α∀the␈α∀Yellow␈α∀arm␈α∃can␈α∀be␈α∀assumed␈α∀to␈α∃be␈α∀at
␈↓I.1.2␈α?␈α?␈α?␈α?␈α?␈α?␈α0BOLTING A BRACKET␈↓
aPage 95
␈↓β␈↓ αHBRACKET_GRASP␈α∀no␈α∪matter␈α∀how␈α∀control␈α∪got␈α∀here,␈α∀eg.␈α∪possibly␈α∀moving␈α∀away␈α∪and
␈↓β␈↓ αHretrying␈α"the␈α"grasp.␈α" (BRACKET_GRASP)␈α"specifies␈α"the␈α"planning␈α"value␈α!of
␈↓β␈↓ αHBRACKET_GRASP;
␈↓ BRACKET_GRASP ← YELLOW;
␈↓␈↓ αH␈↓βCOMMENT␈α⊗this␈α⊗generates␈α⊗code␈α⊗to␈α⊗be␈α⊗run␈α⊗at␈α⊗run-time␈α⊗which␈α⊗updates␈α⊗the␈α⊗frame
␈↓β␈↓ αHBRACKET_GRASP␈α(which␈αin␈αturn␈αupdates␈αBRACKET␈αand␈αBRACKET_HOLE).␈α The
␈↓β␈↓ αHresult␈α∪is␈α∩that␈α∪the␈α∩following␈α∪attach␈α∩uses␈α∪the␈α∩best␈α∪run-time␈α∩value␈α∪of␈α∪the␈α∩BRACKET's
␈↓β␈↓ αHposition;
␈↓ ATTACH BRACKET TO YELLOW;
␈↓ MOVE BRACKET_HOLE TO BEAM_HOLE + (0, 0, 1.3) WRT BEAM_HOLE;
␈↓␈↓ αH␈↓βCOMMENT␈α
this␈α
uses␈α
the␈α
TABLE's␈α
DEPARTURE␈α
(since␈α
the␈α
BRACKET␈α
is␈α
not␈α
attached
␈↓β␈↓ αHto␈α
anything)␈α
and␈αthe␈α
BEAM_HOLE's␈α
approach␈α(since␈α
it␈α
is␈αthe␈α
only␈α
frame␈α
mentioned␈αin
␈↓β␈↓ αHthe␈α
destination).␈α
This␈α
move␈α
should␈α
position␈α
the␈α
BRACKET␈α
just␈α
off␈α
of␈α
the␈α
BEAM.␈α The
␈↓β␈↓ αHnext motion pushes it up against the BEAM;
␈↓ MOVE YELLOW TO ⊗ + (0, 0, .5) WRT BEAM_HOLE
␈↓ ON FORCE(Z WRT BEAM_HOLE) > 50 DO STOP YELLOW
␈↓ ON ARRIVAL DO ABORT ("I SEEM TO HAVE GONE TOO FAR");
␈↓␈↓ βλ␈↓βCOMMENT␈αGive␈α
up␈αif␈α
the␈αexpected␈α
force␈αis␈α
not␈αfelt.␈α
"ARRIVAL"␈αmeans␈α
that␈αthe
␈↓β␈↓ βλarm␈α∞reached␈α
its␈α∞destination␈α
without␈α∞being␈α
stopped␈α∞by␈α
any␈α∞of␈α
the␈α∞ON-conditions.␈α
In
␈↓β␈↓ βλthis␈αcase␈αthis␈αmeans␈αthat␈αthe␈αarm␈αdid␈αnot␈αreach␈αthe␈αexpected␈αforce,␈αwhich␈α
means␈αthat
␈↓β␈↓ βλsomething␈α∩went␈α∩wrong.␈α∩ The␈α∩STOP␈α⊃YELLOW␈α∩disables␈α∩all␈α∩ON␈α∩monitors␈α∩for␈α⊃the
␈↓β␈↓ βλYELLOw arm;
␈↓ END "PICK UP BRACKET BY YELLOW";
␈↓ BEGIN "PICK UP BOLT BY BLUE"
␈↓␈↓ αH␈↓βCOMMENT meanwhile the BLUE arm can be picking up the BOLT;
␈↓ OPERATE BFINGERS WITH OPENING=1;
␈↓ MOVE BLUE TO BOLT;
␈↓ CENTER BLUE;
␈↓␈↓ αH␈↓βCOMMENT assume everything is OK;
␈↓ BOLT ← BLUE;
␈↓ ATTACH BOLT TO TABLE;
␈↓ END "PICK UP BOLT BY BLUE"
␈↓COEND "POSITIONING";
␈↓␈↓βCOMMENT␈αThe␈α
BRACKET␈αshould␈α
be␈αpositioned␈α
next␈αto␈α
the␈αBEAM␈α
and␈αthe␈α
BLUE␈αarm␈αshould␈α
be
␈↓βholding the BOLT;
␈↓MOVE BOLT TO BEAM_HOLE + (0, 0, -5.3) WRT BEAM_HOLE
␈↓ USING THE_APPROACH(BEAM_HOLE);
␈↓␈↓ αλ␈↓βCOMMENT this should position the bolt .3 centimeter off of the BRACKET;
␈↓␈↓βCOMMENT␈α∞now␈α
begin␈α∞a␈α∞search␈α
just␈α∞in␈α∞case␈α
the␈α∞BOLT␈α
doesn't␈α∞immediately␈α∞go␈α
in␈α∞the␈α∞hole:␈α
make
␈↓β.2cm steps around in a spiral; if the BOLT does not go in within nine tries, abort the program;
␈↓FRAME SET; SCALAR N;
␈↓␈↓ αλ␈↓βCOMMENT N is the number of attempts;
␈↓N ← 0;
␈↓SET ← BLUE;
␈↓␈↓ αλ␈↓βCOMMENT save initial arm position;
␈↓Page 96␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ ∪I.1.2
␈↓SEARCH BLUE
␈↓ INCREMENT .2;
␈↓ NORMAL_TO Z WRT BEAM_HOLE;
␈↓ REPEATING
␈↓ BEGIN "INSERTING"
␈↓ MOVE BLUE TO ⊗ + (0, 0, 1.6) WRT BEAM_HOLE
␈↓ ON FORCE(Z WRT BEAM_HOLE) > 60 DO
␈↓ BEGIN "MISSED AGAIN"
␈↓ STOP BLUE;
␈↓ N ← N + 1;
␈↓ IF N > 9 THEN ABORT ("GIVING UP THE SEARCH");
␈↓ MOVE BLUE TO SET
␈↓ END "MISSED AGAIN"
␈↓ ON ARRIVAL DO TERMINATE;
␈↓␈↓ ∧λ␈↓βCOMMENT␈α
this␈α
means␈α∞that␈α
if␈α
the␈α
MOVE␈α∞succeeds␈α
in␈α
reaching␈α∞its␈α
goal,
␈↓β␈↓ ∧λstop the search. TERMINATE is a key word within SEARCH's;
␈↓ END;
␈↓ASSERT BLUE = BEAM_HOLE + (0, 0, 3.7) WRT BEAM_HOLE;
␈↓␈↓ αλ␈↓βCOMMENT expect to have the bolt (which is 4 cm) .3 cm into the hole;
␈↓MOVE BLUE TO ⊗ * [(0, 0, 4):(0, 0, 90)]
␈↓ USING FREE=(X WRT BLUE), FREE=(Y WRT BLUE)
␈↓ ON FORCE(Z WRT BLUE) > 60 DO STOP BLUE;
␈↓␈↓ αH␈↓βCOMMENT␈αthis␈αmoves␈αthe␈αarm␈α4cm␈αstraight␈αahead␈αand␈αtwists␈αit␈α90␈αdegrees␈αabout␈αits␈αZ
␈↓β␈↓ αHaxis (ie. straight ahead). Thus it moves ahead and twists;
␈↓COBEGIN "DISENGAGE"
␈↓ BEGIN "YELLOW"
␈↓ OPERATE YFINGERS WITH OPENING = 1;
␈↓ DETACH BRACKET FROM YELLOW;
␈↓ ATTACH BRACKET TO BEAM;
␈↓ MOVE YELLOW TO YPARK
␈↓ END "YELLOW";
␈↓ BEGIN "BLUE"
␈↓ OPERATE BFINGERS WITH OPENING = 1;
␈↓ DETACH BOLT FROM BLUE;
␈↓ ATTACH BOLT TO BEAM;
␈↓ MOVE BLUE TO BPARK
␈↓ END "BLUE"
␈↓COEND "DISENGAGE";
␈↓WRITE("FINISHED");
␈↓I.1.3␈α?␈α?␈α?␈α?␈α?␈α?␈α0BOLTING A BRACKET␈↓
aPage 97
␈↓␈↓βI.1.3 EXAMPLE THREE␈↓
␈↓This␈α⊃example␈α⊃employs␈α⊃a␈α⊃text␈α⊂macro␈α⊃to␈α⊃simplify␈α⊃definitions,␈α⊃a␈α⊂macro␈α⊃to␈α⊃shorten␈α⊃the␈α⊃code␈α⊂for
␈↓searching,␈α∞and␈α∞a␈α
library␈α∞routine␈α∞to␈α∞GRASP␈α
things.␈α∞ The␈α∞library␈α∞routine␈α
is␈α∞supposed␈α∞to␈α∞cover␈α
a
␈↓number␈α∞of␈α
possibilities␈α∞and␈α
provide␈α∞for␈α
a␈α∞number␈α
of␈α∞parameters.␈α
Since␈α∞library␈α
routines␈α∞can␈α
be
␈↓called␈α∂with␈α∂a␈α∂subset␈α∂of␈α∂their␈α∂parameters␈α∂filled␈α∂in,␈α∂the␈α∂routine's␈α∂flexibility␈α∂is␈α∂not␈α∂oppressive␈α∞for
␈↓those users who just want to do something simple.
␈↓We begin by defining a few little macros to change the conventions for defining macros:
␈↓MACRO BEGIN_MACRO "[]" = [= ⊂];
␈↓␈↓ αλ␈↓βCOMMENT the "[]" is a way of specifying special macro delimiters for this one macro;
␈↓DEFINE END_MACRO "[]" = [⊃];
␈↓MACRO DEFINE_WRT(NEW_FRAME, MAIN_FRAME, POSITION)
␈↓ BEGIN_MACRO
␈↓ NEW_FRAME ← MAIN_FRAME * POSITION;
␈↓ ATTACH NEW_FRAME TO MAIN_FRAME;
␈↓ END_MACRO;
␈↓A typical call might be:
␈↓ DEFINE_WRT(BRACKET_HOLE, BRACKET, [(5.1, 2, 0) : (180, 0, 90)]);
␈↓which would expand into:
␈↓ BRACKET_HOLE ← BRACKET * [(5.1, 2, 0) : (180, 0, 90)];
␈↓ ATTACH BRACKET_HOLE TO BRACKET;
␈↓Notice␈αthat␈αthe␈αparser␈αis␈αsmart␈αenough␈αto␈αdistinguish␈αbetween␈αthe␈αcommas␈αwhich␈αappear␈αwithin␈αa
␈↓construct (eg. the frame) and the commas that appear between the parameter values.
␈↓The␈αfollowing␈αmacro␈αproduces␈αa␈αstring␈αof␈αtokens␈αwhich␈αimply␈αa␈αcompile␈αtime␈αcheck␈αon␈αthe␈αvalue
␈↓of␈α∂the␈α∂conditional␈α⊂expanded␈α∂by␈α∂the␈α⊂parameter␈α∂RIGID.␈α∂ If␈α⊂RIGID␈α∂is␈α∂a␈α⊂"1"␈α∂(ie.␈α∂true)␈α⊂the␈α∂token
␈↓sequence which rigidly attaches the new frame to the main frame is used.
␈↓MACRO DEFINE_WRT(NEW_FRAME, MAIN_FRAME, POSITION, RIGID)
␈↓ BEGIN_MACRO
␈↓ NEW_FRAME ← MAIN_FRAME * POSITION;
␈↓ COMPILE IF RIGID
␈↓ THEN ATTACH NEW_FRAME TO MAIN_FRAME RIGIDLY
␈↓ ELSE ATTACH NEW_FRAME TO MAIN_FRAME;
␈↓ END_MACRO;
␈↓A pair of macros THE_APPROACH(...) and THE_DEPARTURE(...) which
␈↓expand into a compile-time statement which searches the data base for
␈↓any explicit DEPROACH associated with the parameter:
␈↓MACRO THE_DEPARTURE(X) = ⊂PICK(DEPROACH X BIND(*))⊃;
␈↓MACRO THE_APPROACH(X) = ⊂PICK(DEPROACH X BIND(*))⊃;
␈↓Page 98␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ ∪I.1.3
␈↓Another, more complicated macro to facilitate a normal search:
␈↓MACRO NORMAL_SEARCH(THE_ARM, INCREM, DIST_FWD,
␈↓ STOPPING_FORCE, NUM_TRIES)
␈↓ BEGIN_MACRO
␈↓ BEGIN COMMENT this BEGIN is part of the macro code;
␈↓ FRAME SET; SCALAR N;
␈↓␈↓ βλ␈↓βCOMMENT N is the number of attempts;
␈↓ N ← 0;
␈↓ SET ← THE_ARM;
␈↓␈↓ βλ␈↓βCOMMENT save initial arm position;
␈↓ SEARCH THE_ARM
␈↓ INCREMENT INCREM
␈↓ NORMAL_TO Z WRT THE_ARM;
␈↓ REPEATING
␈↓ BEGIN "INSERTION"
␈↓ MOVE THE_ARM TO ⊗ + (0, 0, DIST_FWD) WRT THE_ARM
␈↓ ON FORCE(Z WRT THE_ARM) > STOPPING_FORCE DO
␈↓ BEGIN "MISSED AGAIN"
␈↓ STOP THE_ARM;
␈↓ N ← N + 1;
␈↓ IF N > NUM_TRIES THEN ABORT("GIVING UP");
␈↓ MOVE THE_ARM TO SET;
␈↓ END "MISSED AGAIN"
␈↓ ON ARRIVAL DO TERMINATE;
␈↓ END "INSERTION";
␈↓ ASSERT THE_ARM = (SET) + (0, 0, (DIST_FWD - 1));
␈↓␈↓ βλ␈↓βCOMMENT␈αthis␈αchanges␈αthe␈αcompiler's␈αview␈αto␈αbelieve␈αthat␈αthe␈αarm␈αsucceeds␈αon␈αthe
␈↓β␈↓ βλfirst␈α⊂attempt,␈α∂BUT␈α⊂that␈α∂it␈α⊂does␈α⊂NOT␈α∂go␈α⊂as␈α∂far␈α⊂as␈α∂DIST_FWD␈α⊂...␈α⊂possibly␈α∂more
␈↓β␈↓ βλrealistic;
␈↓ END;
␈↓ END_MACRO;
␈↓A typical call would be:
␈↓ NORMAL_SEARCH(YELLOW, .2, 1.6, 60, 9);
␈↓The above macro could easily be made into a library routine as follows:
␈↓ROUTINE NORMAL_SEARCH(FRAME THE_ARM; SCALAR INCREM, DIST_FWD,
␈↓ STOPPING_FORCE, NUM_TRIES(DEFAULT 9));
␈↓ BEGIN
␈↓ ...
␈↓ END;
␈↓The corresponding call:
␈↓ NORMAL_SEARCH(YELLOW, .2, 1.6, 60, 9);
␈↓The "9" is a default value if no value is specified in the call. Thus, by
␈↓I.1.3␈α?␈α?␈α?␈α?␈α?␈α?␈α0BOLTING A BRACKET␈↓
aPage 99
␈↓naming the parameters the same call can be made by:
␈↓ NORMAL_SEARCH(THE_ARM=YELLOW, DIST_FWD=1.6,
␈↓ STOPPING_FORCE=60, INCREM=.2);
␈↓Notice that the order is not important if the parameters are named.
␈↓The following routine is a library routine to grasp things. Basically it
␈↓does the following:
␈↓␈↓ αH(1) Optionally open to an OPENING_BEFORE_DEPARTURE.
␈↓␈↓ αH(2)␈α
Depart␈α
via␈α
a␈α
DEPARTURE␈α
(if␈α
there␈α
is␈α
one␈α
...␈α
a␈α
SPECIAL_DEPARTURE␈α∞can␈α
be
␈↓␈↓ βλspecified).
␈↓␈↓ αH(3)␈α∨Start␈α∨opening␈α≡the␈α∨fingers␈α∨to␈α≡the␈α∨OPENING_FOR_APPROACH␈α∨at␈α≡the
␈↓␈↓ βλDEPARTURE␈α
point␈α
(if␈α
SPECIAL_DEPARTURE␈α
is␈α
specified,␈α
use␈α
it.␈α Otherwise,
␈↓␈↓ βλuse the standard DEPROACH value.).
␈↓␈↓ αH(4)␈α.Approach␈α-the␈α.GRASPING_POINT␈α.via␈α-the␈α.APPROACH␈α.(if␈α-a
␈↓␈↓ βλSPECIAL_APPROACH is specified, use it).
␈↓␈↓ αH(5)␈α∃Center␈α∃on␈α∃the␈α⊗object.␈α∃(If␈α∃the␈α∃fingers␈α∃close␈α⊗so␈α∃that␈α∃the␈α∃opening␈α∃is␈α⊗less␈α∃than
␈↓␈↓ βλ(THICKNESS␈α
-␈α
.10)␈α
call␈α∞the␈α
operator␈α
and␈α
give␈α∞her␈α
one␈α
chance␈α
to␈α∞re-position␈α
the
␈↓␈↓ βλobject and try again.)
␈↓␈↓ αH(6)␈αUpon␈αsuccessfully␈αcentering␈αon␈α
the␈αGRASP_POINT,␈αupdate␈αthe␈αOBJECT's␈α
position
␈↓␈↓ βλby␈α∀assigning␈α∀the␈α∀GRASP_POINT␈α∃the␈α∀current␈α∀hand␈α∀location␈α∀(this,␈α∃of␈α∀course,
␈↓␈↓ βλassumes␈αthat␈αeither␈αthe␈αGRASP_POINT␈αand␈αthe␈αOBJECT␈αare␈αthe␈αsame␈αframe␈αor
␈↓␈↓ βλthat the GRASP_POINT is RIGIDLY attached to the OBJECT).
␈↓Notice that this routine can be used by either arm.
␈↓ROUTINE GRASP(COMPILE_TIME SPECIAL_DEPARTURE, SPECIAL_APPROACH;
␈↓ FRAME THE_ARM(DEFAULT YELLOW), OBJECT, GRASP_POINT,
␈↓ THING_OBJECT_ATTACHED_TO;
␈↓ SCALAR OPENING_BEFORE_DEPARTURE,
␈↓ OPENING_FOR_APPROACH(DEFAULT 15),
␈↓ THICKNESS(DEFAULT .11));
␈↓ BEGIN "GRASP"
␈↓␈↓ αH␈↓βCOMMENT␈αSPECIAL_DEPARTURE␈αis␈αa␈αframe␈αexpression␈αfor␈αthe␈αrelative␈αposition␈αof
␈↓β␈↓ αHdeparture.␈α SPECIAL_APPROACH␈αis␈αa␈αframe␈αexpression␈αfor␈αthe␈αrelative␈αposition␈αof␈αthe
␈↓β␈↓ αHapproach.␈α∞ THING_OBJECT_ATTACHED_TO␈α∞is␈α∞the␈α∞name␈α∞of␈α∞the␈α∞frame␈α∞OBJECT␈α
is
␈↓β␈↓ αHattached␈αto␈α
(if␈αthere␈α
is␈αone)␈αbefore␈α
the␈αGRASP␈α
routine␈αis␈αcalled.␈α
It␈αis␈α
used␈αto␈αspecify␈α
what
␈↓β␈↓ αHthe␈αOBJECT␈αshould␈α
be␈αdetached␈αfrom␈αupon␈α
being␈αGRASPed.␈α THICKNESS␈αis␈α
defaulted
␈↓β␈↓ αHto␈α∞.11␈α
so␈α∞that␈α∞the␈α
ON␈α∞monitor␈α∞ON␈α
OPENING␈α∞<␈α∞(THICKNESS␈α
-␈α∞.10)␈α∞DO␈α
...␈α∞will␈α∞do␈α
a
␈↓β␈↓ αHreasonable thing;
␈↓ COMPILE_TIME T, U, THE_FINGERS;
␈↓Page 100␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ ∪I.1.3
␈↓ COMPILE IF THE_ARM = BLUE
␈↓ THEN THE_FINGERS ← ⊂BFINGERS⊃
␈↓ ELSE THE_FINGERS ← ⊂YFINGERS⊃;
␈↓␈↓ αH␈↓βCOMMENT␈αThis␈αsets␈αup␈αthe␈αcompile-time␈αvariable␈αTHE_FINGERS␈αto␈αexpand␈αinto␈αthe
␈↓β␈↓ αHcorrect␈α∞fingers␈α∂expression␈α∞for␈α∂the␈α∞OPERATE␈α∂statements␈α∞(depending␈α∂upon␈α∞the␈α∂choice␈α∞of
␈↓β␈↓ αHarm);
␈↓ COMPILE IF SPECIFIED(OPENING_BEFORE_DEPARTURE) THEN
␈↓ OPERATE #(THE_FINGERS) WITH OPENING=OPENING_BEFORE_DEPARTURE;
␈↓␈↓ αH␈↓βCOMMENT␈α∂the␈α∂next␈α∂statement␈α∂sets␈α∂up␈α∂a␈α∂compile-time␈α∂variable,␈α∂U,␈α∂which␈α∂contains␈α∂the
␈↓β␈↓ αHphrase␈α"USING␈αAPPROACH␈α=␈α<the␈αspecial>"␈αor␈αNIL␈αdepending␈αupon␈αwhether␈αor␈αnot␈αa
␈↓β␈↓ αHspecial␈α⊃approach␈α⊂has␈α⊃been␈α⊃specified.␈α⊂ This␈α⊃constructed␈α⊂phrase␈α⊃is␈α⊃used␈α⊂in␈α⊃two␈α⊃or␈α⊂three
␈↓β␈↓ αHplaces below to insure that the desired approach is being used;
␈↓ COMPILE IF SPECIFIED(SPECIAL_APPROACH)
␈↓ THEN U ← ⊂ USING APPROACH = #(SPECIAL_APPROACH) ⊃
␈↓ ELSE U ← ⊂ NIL ⊃;
␈↓ COMPILE IF SPECIFIED(SPECIAL_DEPARTURE)
␈↓ THEN MOVE THE_ARM TO GRASP_POINT
␈↓ USING DEPARTURE=NIL
␈↓ VIA THE_ARM * #(SPECIAL_DEPARTURE) THEN
␈↓ BEGIN
␈↓ OPERATE #(THE_FINGERS)
␈↓ WITH OPENING=OPENING_FOR_APPROACH
␈↓ END
␈↓ #(U)
␈↓ ELSE MOVE THE_ARM TO GRASP_POINT
␈↓ USING DEPARTURE=NIL
␈↓ VIA THE_ARM * THE_DEPARTURE(GRASP_POINT) THEN
␈↓ BEGIN
␈↓ OPERATE #(THE_FINGERS)
␈↓ WITH OPENING=OPENING_FOR_APPROACH
␈↓ END
␈↓ #(U);
␈↓ CENTER THE_ARM
␈↓ ON OPENING < (THICKNESS-.10) DO
␈↓ BEGIN "MISSED OBJECT"
␈↓ STOP THE_ARM;
␈↓ SCALAR FLAG;
␈↓ OPERATE THE_FINGERS WITH OPENING=OPENING_FOR_APPROACH;
␈↓ COMPILE IF SPECIFIED(SPECIAL_APPROACH)
␈↓ THEN BEGIN "MOVE TO SPECIAL APPROACH POINT"
␈↓ MOVE THE_ARM TO THE_ARM * #(SPECIAL_APPROACH)
␈↓ USING APPROACH=NIL, DEPARTURE=NIL;
␈↓ END "MOVE TO SPECIAL APPROACH POINT"
␈↓ ELSE BEGIN "USE THE NORMAL APPROACH"
␈↓ MOVE THE_ARM
␈↓ TO THE_ARM * THE_APPROACH(GRASP_POINT)
␈↓ DIRECTLY;
␈↓I.1.3␈α?␈α?␈α?␈α?␈α?␈α?␈α0BOLTING A BRACKET␈↓
RPage 101
␈↓ END "USE THE NORMAL APPROACH";
␈↓ WRITE("GRASP FAILED ... TYPE A `1' TO RETRY");
␈↓ READ(FLAG);
␈↓␈↓ βH␈↓βCOMMENT this is simply "wait for proceed";
␈↓ IF FLAG ␈↓ε≠␈↓ 1 THEN ABORT;
␈↓ MOVE THE_ARM TO GRASP_POINT
␈↓ USING DEPARTURE=NIL,APPROACH=NIL;
␈↓ CENTER THE_ARM
␈↓ ON OPENING < (THICKNESS-.10) DO ABORT ("CLOSED ON AIR");
␈↓ END "MISSED OBJECT";
␈↓ ASSERT THE_ARM = GRASP_POINT;
␈↓ GRASP_POINT ← THE_ARM;
␈↓ COMPILE IF SPECIFIED(THING_OBJECT_ATTACHED_TO) THEN
␈↓ DETACH OBJECT FROM THING_OBJECT_ATTACHED_TO;
␈↓ ATTACH OBJECT TO THE_ARM;
␈↓ END "GRASP";
␈↓The following is a typical call on such a routine:
␈↓ GRASP(THE_ARM=YELLOW, OBJECT=BRACKET,
␈↓ GRASP_POINT=BRACKET_GRASP,
␈↓ SPECIAL_APPROACH=⊂ [(0,0,-3):(0,0,0)] ⊃,
␈↓ OPENING_FOR_APPROACH=1);
␈↓which expands into:
␈↓ MOVE YELLOW TO BRACKET_GRASP
␈↓ USING DEPARTURE=NIL
␈↓ VIA YELLOW * [(0,0,10):(0,0,0)] THEN
␈↓ BEGIN
␈↓ OPERATE YFINGERS WITH OPENING=1
␈↓ END
␈↓ USING APPROACH = [(0,0,-3):(0,0,0)];
␈↓ CENTER YELLOW
␈↓ ON OPENING < .01 DO
␈↓ BEGIN "MISSED OBJECT"
␈↓ STOP YELLOW;
␈↓ SCALAR FLAG;
␈↓ OPERATE YFINGERS WITH OPENING=1;
␈↓ MOVE YELLOW TO YELLOW*[(0,0,-3);(0,0,0)]
␈↓ USING APPROACH=NIL,DEPARTURE=NIL;
␈↓ WRITE("GRASP FAILED ... TYPE A `1' TO RETRY");
␈↓ READ(FLAG);
␈↓ IF FLAG ␈↓ε≠␈↓ 1 THEN ABORT;
␈↓ MOVE YELLOW TO BRACKET_GRASP
␈↓ USING APPROACH=NIL,DEPARTURE=NIL;
␈↓ CENTER YELLOW
␈↓ ON OPENING < .01 DO ABORT ("CLOSED ON AIR");
␈↓ END "MISSED OBJECT";
␈↓Page 102␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ ∪I.1.3
␈↓ ASSERT YELLOW = BRACKET_GRASP;
␈↓ BRACKET_GRASP ← YELLOW;
␈↓ ATTACH BRACKET TO YELLOW;
␈↓Finally,␈α∂the␈α∂whole␈α∂task␈α∂is␈α∂made␈α∂into␈α∂a␈α∂library␈α∂routine␈α∂so␈α∂it␈α∂can␈α∂be␈α∂`called'␈α∂(ie.␈α∂expanded)␈α⊂as␈α∂a
␈↓subtask from a higher level task.
␈↓ROUTINE BOLT_ON_BRACKET;
␈↓ BEGIN "WHOLE TASK"
␈↓ COMPILE IF #(YELLOW) ␈↓ε≠␈↓ YPARK THEN
␈↓ COMPILE_ERROR("THE YELLOW ARM IS NOT PLANNED TO BE IN ITS
␈↓ PARK POSITION ... AS ASSUMED BY THE ROUTINE
␈↓ BOLT_ON_BRACKET");
␈↓ COMPILE IF (ATTACHED ANYTHING YELLOW) THEN
␈↓ COMPILE_ERROR("SOMETHING IS ATTACHED TO THE YELLOW HAND ...
␈↓ AND THE ROUTINE BOLT_ON_BRACKET EXPECTS THE
␈↓ HAND TO BE EMPTY");
␈↓␈↓ αH␈↓βCOMMENT␈α
this␈α
type␈α
of␈α
compile␈α
time␈α
check␈α∞and␈α
warning␈α
to␈α
the␈α
user␈α
is␈α
very␈α∞useful␈α
for
␈↓β␈↓ αHinsuring␈α
that␈α
the␈α∞interface␈α
assumptions␈α
for␈α∞routines␈α
are␈α
met␈α∞in␈α
the␈α
planning␈α∞world␈α
just
␈↓β␈↓ αHbefore␈α the␈α∨routine␈α is␈α expanded.␈α∨ Notice␈α that␈α there␈α∨is␈α a␈α built-in␈α∨procedure,
␈↓β␈↓ αHCOMPILE_ERROR,␈α∂which␈α∂prints␈α⊂the␈α∂included␈α∂message␈α⊂at␈α∂compile-time␈α∂and␈α⊂stops␈α∂the
␈↓β␈↓ αHcompilation.␈α∂ There␈α∂is␈α∞also␈α∂a␈α∂compile-time␈α∞WRITE␈α∂statement,␈α∂MESSAGE("␈α∂...").␈α∞ These
␈↓β␈↓ αHtwo␈α∃different␈α∃`output'␈α∃statements␈α∃are␈α∃used␈α∃so␈α∃that␈α∃the␈α∃user␈α∃can␈α∃generate␈α∃WRITE
␈↓β␈↓ αHstatements within a COMPILE IF.;
␈↓ COBEGIN
␈↓ BEGIN "PICK UP BRACKET WITH YELLOW"
␈↓ GRASP(GRASP_POINT=BRACKET_GRASP, OBJECT=BRACKET,
␈↓ OPENING_FOR_APPROACH=1);
␈↓ MOVE BRACKET_HOLE TO BEAM_HOLE + (0, 0, 1.3) WRT BEAM_HOLE;
␈↓ MOVE YELLOW TO ⊗ + (0, 0, .5) WRT BEAM_HOLE
␈↓ ON FORCE(Z WRT BEAM_HOLE) > 50 DO STOP YELLOW
␈↓ ON ARRIVAL DO ABORT("I SEEM TO HAVE GONE TOO FAR");
␈↓ END "PICK UP BRACKET WITH YELLOW;
␈↓ BEGIN "PICK UP BOLT WITH BLUE"
␈↓ GRASP(THE_ARM=BLUE, OBJECT=BOLT, GRASP_POINT=BOLT,
␈↓ OPENING_FOR_APPROACH=1)
␈↓ END "PICK UP BOLT WITH BLUE"
␈↓ COEND;
␈↓ MOVE BOLT TO BEAM_HOLE + (0, 0, -5.3) WRT BEAM_HOLE;
␈↓ NORMAL_SEARCH(BLUE, .2, 1.6, 60, 9);
␈↓␈↓ αH␈↓βCOMMENT assume that the bolt is now in the hole;
␈↓ MOVE BLUE TO ⊗ * [(0, 0, 4):(0, 0, 90)]
␈↓ ON FORCE(Z WRT BLUE) > 60 DO STOP BLUE;
␈↓ COBEGIN "DISENGAGE"
␈↓I.1.3␈α?␈α?␈α?␈α?␈α?␈α?␈α0BOLTING A BRACKET␈↓
RPage 103
␈↓ BEGIN "YELLOW"
␈↓ OPERATE YFINGERS WITH OPENING = 1;
␈↓ DETACH BRACKET FROM YELLOW;
␈↓ ATTACH BRACKET TO BEAM;
␈↓ MOVE YELLOW TO YPARK
␈↓ END "YELLOW";
␈↓ BEGIN "BLUE"
␈↓ OPERATE BFINGERS WITH OPENING = 1;
␈↓ DETACH BOLT FROM BLUE;
␈↓ ATTACH BOLT TO BEAM;
␈↓ MOVE BLUE TO BPARK
␈↓ END "BLUE"
␈↓ COEND "DISENGAGE";
␈↓END "WHOLE TASK";
␈↓Page 104␈α?␈α?␈α?␈α?␈α?␈α?␈α_BOLTING A BRACKET␈↓ ∪I.1.3
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈αβFigure 1.1
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α2Initial World
␈↓I.1.3␈α?␈α?␈α?␈α?␈α?␈α?␈α0BOLTING A BRACKET␈↓
RPage 105
␈↓␈↓∧I.2 EXAMPLES OF COORDINATED ACTION␈↓
␈↓These␈αtwo␈α
examples␈αtake␈αinto␈α
account␈αsome␈αof␈α
the␈αmore␈α
subtle␈αaspects␈αof␈α
assembly␈αsuch␈αas␈α
freeing
␈↓the␈αBRACKET␈α
while␈αtrying␈α
to␈αinsert␈αthe␈α
bolt␈αin␈α
the␈αhole␈αand␈α
changing␈αthe␈α
speed␈αof␈α
the␈αdriver
␈↓dynamically.
␈↓The␈α
following␈αsection␈α
of␈αcode␈α
is␈αdesigned␈α
to␈αsimultaneously␈α
free␈αthe␈α
YELLOW␈αarm␈α
and␈αmove␈α
the
␈↓BLUE␈αarm␈α
to␈αinsert␈α
the␈αbolt.␈α
The␈αfreeing␈α
of␈αthe␈α
YELLOW␈αarm␈α
is␈αto␈α
allow␈αthe␈α
BRACKET␈αto
␈↓accommodate slightly along the surface of the BEAM as the BLUE arm tries to insert the bolt.
␈↓MOVE BOLT TO BEAM_HOLE + (0, 0, -5.3) WRT BEAM_HOLE;
␈↓␈↓ αλ␈↓βCOMMENT remember that the BOLT is in the BLUE hand;
␈↓MOVE YELLOW TO ⊗
␈↓ USING FREE=(X WRT BEAM_HOLE), FREE=(Y WRT BEAM_HOLE)
␈↓ ON DURATION > 0 DO
␈↓ BEGIN "INSERTION"
␈↓␈↓ βλ␈↓βCOMMENT␈α∂notice␈α∂that␈α∂"DURATION␈α⊂>␈α∂0"␈α∂is␈α∂an␈α∂approximation␈α⊂to␈α∂simultaneous
␈↓β␈↓ βλmotions;
␈↓ NORMAL_SEARCH(BLUE, .2, 1.6, 60, 9);
␈↓␈↓ βλ␈↓βCOMMENT assume that the bolt is now in the hole;
␈↓ MOVE BLUE TO ⊗ * [(0, 0, 4):(0, 0, 90)]
␈↓ ON FORCE(Z WRT BLUE) > 60 DO STOP YELLOW;
␈↓ END "INSERTION";
␈↓ ON DURATION > 4 DO ABORT("OPERATION TOOK TOO LONG");
␈↓␈↓ αH␈↓βCOMMENT␈α∩the␈α⊃"ON␈α∩DURATION␈α⊃>␈α∩4␈α⊃DO␈α∩ABORT"␈α⊃will␈α∩generate␈α⊃an␈α∩error␈α∩if␈α⊃the
␈↓β␈↓ αHinsertion␈α∂takes␈α∂more␈α∞than␈α∂4␈α∂seconds.␈α∞ The␈α∂error␈α∂will␈α∞force␈α∂the␈α∂operator␈α∞to␈α∂deal␈α∂with␈α∞the
␈↓β␈↓ αHsituation at supervisor level;
␈↓Without the SEARCH this could be accomplished in "weak" synchrony:
␈↓MOVE BOLT TO BEAM_HOLE + (0, 0, -5.3) WRT BEAM_HOLE;
␈↓MOVE {BLUE, YELLOW}
␈↓ TO {⊗ + (0, 0, 1.6) WRT BLUE, ⊗}
␈↓ USING FREE = {*, (X WRT BEAM_HOLE)}
␈↓ USING FREE = {*, (Y WRT BEAM_HOLE)}
␈↓ ON {FORCE(Z WRT BLUE) > 60, *} DO {STOP, STOP};
␈↓It␈αis␈αawkward␈αto␈αinclude␈αthe␈αSEARCH␈αin␈αsuch␈αa␈αscheme.␈α In␈αfact,␈αthis␈αtype␈αof␈αcoordination␈αcomes
␈↓up␈αin␈αa␈αnumber␈αof␈αother␈αplaces.␈α For␈αexample,␈αif␈αyou␈αwant␈αto␈αoperate␈αa␈αdevice␈α(eg.␈αthe␈αDRIVER)
␈↓and␈αmove␈αan␈αarm␈α
or␈αcamera␈α"at␈αthe␈αsame␈α
time."␈αEvents␈αand␈αsynchronizing␈αprimitives␈α
have␈αbeen
␈↓added to solve these control problems. Consider the following way of programming this task:
␈↓EVENT Y_READY, B_READY;
␈↓␈↓ αλ␈↓βCOMMENT␈α⊃Y_READY␈α⊂is␈α⊃an␈α⊃event␈α⊂signalling␈α⊃that␈α⊂the␈α⊃YELLOW␈α⊃arm␈α⊂is␈α⊃ready␈α⊃to␈α⊂move.
␈↓β␈↓ αλB_READY indicates that the BLUE arm is ready to move;
␈↓MOVE BOLT TO BEAM_HOLE + (0, 0, -5.3) WRT BEAM_HOLE;
␈↓COBEGIN "INSERT THE BOLT"
␈↓Page 106␈α?␈α?␈α?␈α?␈α?␈α?␈αλCOORDINATED ACTION␈↓ (I.2
␈↓ BEGIN "FREE YELLOW"
␈↓ SIGNAL Y_READY;
␈↓ WAIT B_READY;
␈↓ MOVE YELLOW TO ⊗
␈↓ USING FREE=(X WRT BEAM_HOLE)
␈↓ USING FREE=(Y WRT BEAM_HOLE)
␈↓ ON DURATION > 4 DO ABORT("TOOK TOO LONG");
␈↓ END "FREE YELLOW"
␈↓ BEGIN "USE BLUE TO INSERT BOLT"
␈↓ SIGNAL B_READY;
␈↓ WAIT Y_READY;
␈↓ NORMAL_SEARCH(BLUE, .2, 1.6, 60, 9);
␈↓␈↓ αH␈↓βCOMMENT assume that the bolt is now in the hole;
␈↓ MOVE BLUE TO ⊗ * [(0, 0, 4):(0, 0, 90)]
␈↓ ON FORCE(Z WRT BLUE) > 60 DO STOP YELLOW;
␈↓ END "USE BLUE TO INSERT BOLT";
␈↓COEND "INSERT THE BOLT";
␈↓Consider␈αthe␈αproblem␈αof␈α
inserting␈αin␈αa␈αscrew␈αand␈α
checking␈αto␈αmake␈αsure␈α
that␈αit␈αdoes␈αnot␈αbind.␈α
If,
␈↓after␈α
a␈αshort␈α
time,␈α
the␈αscrew␈α
does␈α
not␈αbind,␈α
the␈α
speed␈αof␈α
the␈α
DRIVER␈αcan␈α
be␈αincreased.␈α
However,
␈↓if␈αit␈αdoes␈αbind,␈αeverything␈αshould␈αstop␈αand␈αthe␈αDRIVER␈αshould␈αbe␈αreversed␈αto␈αtry␈αto␈αunbind␈αthe
␈↓screw.
␈↓EVENT D_READY, B_READY;
␈↓SCALAR SP, FLAG;
␈↓SP ← 30;
␈↓FLAG ← 1;
␈↓WHILE FLAG DO
␈↓ BEGIN "SCREW LOOP"
␈↓ COBEGIN "MOVE AND SCREW SIMULTANEOUSLY"
␈↓ BEGIN "OPERATE THE SCREWDRIVER"
␈↓ SIGNAL D_READY;
␈↓ WAIT B_READY;
␈↓ OPERATE DRIVER
␈↓ WITH VELOCITY = SP
␈↓ ON DURATION > 8 DO ABORT("TOOK TOO LONG");
␈↓ END "OPERATE THE SCREWDRIVER"
␈↓ BEGIN "EXERT DOWNWARD FORCE"
␈↓ SIGNAL B_READY;
␈↓ WAIT D_READY;
␈↓ MOVE BLUE TO ⊗
␈↓ USING FREE=(Z WRT BLUE)
␈↓ USING FORCE=((0, 0, 40) WRT BLUE)
␈↓ "BIND" ON TORQUE(Z WRT BLUE) > 80 DO
␈↓ BEGIN "IT BOUND"
␈↓ DISABLE "CATCH_OK";
␈↓I.2␈α?␈α?␈α?␈α?␈α?␈α?␈α0COORDINATED ACTION␈↓
RPage 107
␈↓ STOP BLUE;
␈↓ STOP DRIVER;
␈↓ COBEGIN "TRY TO UNBIND BY REVERSING THE DRIVER"
␈↓ BEGIN "UNSCREW"
␈↓ SIGNAL D_READY;
␈↓ WAIT B_READY;
␈↓ SP ← -60;
␈↓ OPERATE DRIVER
␈↓ WITH VELOCITY = SP
␈↓ ON DURATION > 4 DO ABORT("CANT UNBIND");
␈↓ END "UNSCREW"
␈↓ BEGIN "UPWARD FORCE"
␈↓ SIGNAL B_READY;
␈↓ WAIT D_READY;
␈↓ MOVE BLUE TO ⊗
␈↓ USING FREE=(Z WRT BLUE)
␈↓ USING FORCE=((0, 0, -40) WRT BLUE)
␈↓ "OUT_OK" ON FORCE(Z WRT BLUE)<20 DO
␈↓ BEGIN
␈↓ STOP DRIVER;
␈↓ STOP BLUE;
␈↓␈↓ ¬H␈↓βCOMMENT leave FLAG true for retry;
␈↓ END
␈↓ "TOO_MUCH_TIME" ON DURATION>4 DO ABORT;
␈↓ END "UPWARD FORCE"
␈↓ COEND "TRY TO UNBIND BY REVERSING THE DRIVER"
␈↓ END "IT BOUND"
␈↓ "CATCH_OK" ON DURATION > 1 DO
␈↓ BEGIN
␈↓ DISABLE "BIND";
␈↓ ENABLE "TORQUED_IN_OK";
␈↓ SP ← 60; COMMENT maybe this should be CRITICAL;
␈↓ END;
␈↓ DEFER "TORQUED_IN_OK" ON TORQUE(Z WRT BLUE) > 80 DO
␈↓ BEGIN
␈↓ STOP DRIVER;
␈↓ STOP BLUE;
␈↓ FLAG ← 0; COMMENT indicating no retry;
␈↓ END;
␈↓ END "EXERT DOWNWARD FORCE"
␈↓ COEND "MOVE AND SCREW SIMULTANEOUSLY";
␈↓ END "SCREW LOOP";
␈↓Page 108␈α?␈α?␈α?␈α?␈α?␈απA `VERY HIGH LEVEL' EXAMPLE␈↓ (I.3
␈↓␈↓∧I.3 A `VERY HIGH LEVEL' EXAMPLE␈↓
␈↓This␈αvery␈αshort␈αexample␈αdemontrates␈αthe␈αuse␈αof␈αassembly␈αoriented␈αspecial␈αprimitives␈αto␈αsimplify␈αa
␈↓task␈αspecification,␈αas␈α
well␈αas␈αsome␈α
of␈αthe␈αobject␈αdescription␈α
conventions␈αused␈αby␈α
those␈αprimitives.
␈↓Here,␈αthe␈αtask␈αis␈αthe␈αsame␈αas␈αthat␈αof␈αsubsection␈αI.1.1.␈α For␈αa␈αfuller␈αexplanation␈αof␈αthe␈αuse␈αof␈αsuch
␈↓primitives and another, longer example, see Chapter 5.
␈↓FRAME beam,bracket,bolt;
␈↓FRAME bracket_bore,beam_bore;
␈↓FRAME bolt_grasp,bracket_handle;
␈↓␈↓β{␈αWe␈αmust␈α
first␈αdescribe␈αthe␈αvarious␈α
components.␈α We␈αexpect␈αthat␈α
eventually␈αthe␈αprocess␈α
of␈αmaking
␈↓βsuch␈α∩descriptions␈α∪will␈α∩become␈α∪very␈α∩largely␈α∪automated,␈α∩as␈α∪computer␈α∩programs␈α∪begin␈α∩to␈α∪play␈α∩an
␈↓βincreasingly active role in mechanical design. See Section 5.7 }
␈↓ASSERT FACT (TYPE beam OBJECT);
␈↓ASSERT FACT (GEOMED beam "BEAM.B3D[HAL,HE]"); {Shape description}
␈↓ASSERT FACT (SUBPART beam beam_bore);
␈↓ATTACH beam_bore TO beam RIGIDLY AT [(0,1.5,6)|(0,π/2,0)];
␈↓ASSERT FACT (TYPE bracket OBJECT);
␈↓ASSERT FACT (GEOMED bracket "BRACK.B3D[HAL,HE]"); {Shape description}
␈↓ASSERT FACT (SUBPART bracket bracket_bore);
␈↓ASSERT FACT (SUBPART bracket bracket_handle);
␈↓ATTACH bracket_bore TO bracket RIGIDLY AT [(5.1,2,0)|(π,0,0)];
␈↓ATTACH bracket_handle TO bracket RIGIDLY AT [(0,0,0)|(π,0,0)];
␈↓ASSERT FACT (TYPE bolt SHAFT);
␈↓ASSERT FACT (DIAMETER bolt 0.5);
␈↓ASSERT FACT (TOP_END bolt head_type1);
␈↓ASSERT FACT (BOTTOM_END bolt tiptype1);
␈↓ASSERT FACT (TYPE tiptype1 FLAT_END);
␈↓ASSERT FACT (TYPE bracket_bore BORE);
␈↓ASSERT FACT (DIAMETER bracket_bore 0.502);
␈↓ASSERT FACT (LENGTH bracket_bore 0.5);
␈↓ASSERT FACT (TOP_END beacket_bore bracket_hole1);
␈↓ASSERT FACT (BOTTOM_END beacket_bore bracket_hole1);
␈↓␈↓ αλ␈↓β{et cetera}
␈↓␈↓β{Also, describe how things go together}
␈↓ASSERT FACT (TYPE beam_assembly ASSEMBLY);
␈↓ASSERT FACT (SUBPART beam_assembly beam);
␈↓ASSERT FACT (SUBPART beam_assembly bolt);
␈↓ASSERT FACT (SUBPART beam_assembly bracket);
␈↓ASSERT FACT (bracket FITS_ONTO beam_assembly AT [(5.1,2,0):(0,π/2,0)]);
␈↓I.3␈α?␈α?␈α?␈α?␈α?␈α/A `VERY HIGH LEVEL' EXAMPLE␈↓
RPage 109
␈↓ASSERT FACT (bolt FITS_ONTO beam_assembly AT [(5.1,2.3,0):(0,π/2,0)]);
␈↓ASSERT FACT (MATED beam_hsurf bracket_bottom);
␈↓ASSERT FACT (ALIGNED beam_bore bracket_bore);
␈↓ASSERT FACT (RUNS_THRU bolt bracket_bore);
␈↓ASSERT FACT (RUNS_THRU bolt beam_bore);
␈↓␈↓ αλ␈↓β{et cetera}
␈↓␈↓β{Now, describe the initial scene. Here, assume that the initial object locations are known precisely}
␈↓bracket ← [(20,40,0):(0,0,0)]
␈↓beam ← [(10,60,0):(0,0,0)]
␈↓bolt ← [(30,50,5):(0,π,0)]
␈↓GRASP bracket AT [(0,0,2)|(0,π,0)] WITH YELLOW;
␈↓␈↓β{The system will use its internal model of the bracket to fill in the expected hand opening.}
␈↓FIT bracket ONTO beam_assembly
␈↓ USING YELLOW
␈↓ AFTERWARDS HOLD bracket WITH YELLOW;
␈↓␈↓β{The␈αsystem␈αwill␈αuse␈α
the␈αobject␈αdescription␈αinformation␈α
to␈αfill␈αin␈αthe␈α
exact␈αlocation␈αto␈αwhich␈α
to␈αmove
␈↓βthe␈α∂bracket.␈α∂ Also,␈α∂it␈α∂will␈α∂pick␈α∂appropriate␈α∞techniques␈α∂to␈α∂ensure␈α∂that␈α∂the␈α∂bracket␈α∂is␈α∞appropriately
␈↓βaligned.␈α∞ The␈α
AFTERWARDS␈α∞clause␈α
tells␈α∞the␈α
system␈α∞that␈α
it␈α∞is␈α
to␈α∞use␈α
the␈α∞yellow␈α
arm␈α∞to␈α∞hold␈α
the
␈↓βbracket in place}
␈↓INSERT bolt INTO bracket_hole1 USING BLUE;
␈↓␈↓β{Once␈α
again,␈αthe␈α
system␈αwill␈α
fill␈αin␈α
the␈αdetails,␈α
such␈αas␈α
how␈αthe␈α
bolt␈αis␈α
to␈αbe␈α
grasped,␈αhow␈α
it␈αshould␈α
be
␈↓βbrought to the hole, how it will be pushed in, and so forth.}
␈↓RELEASE bracket; ␈↓β{ Since the bolt now holds it on}␈↓
␈↓Page 110␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α ␈↓ H
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α$␈↓∧APPENDIX II␈↓
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α␈↓¬RUNTIME SYSTEM␈↓
␈↓This␈αappendix␈αdiscusses␈αin␈αgreater␈αdetail␈αsome␈α
of␈αthe␈αaspects␈αof␈αthe␈αruntime␈αsystem,␈αwhich␈α
resides
␈↓on␈α
the␈αPDP11␈α
as␈α
a␈αset␈α
of␈α
programs␈αexecuting␈α
compiled␈αcode,␈α
operating␈α
devices␈αin␈α
real␈α
time␈αand
␈↓receiving sensory input.
␈↓␈↓∧II.1 THE RUNTIME SCHEDULER␈↓
␈↓As␈αmentioned␈αearlier,␈αin␈αchapter␈α7,␈αthe␈αruntime␈αscheduling␈αis␈αmanaged␈αthrough␈αa␈αcombination␈αof
␈↓priority␈α
level␈αassignments␈α
to␈αvarious␈α
types␈αof␈α
processes␈αand␈α
a␈αtime-slot␈α
request␈αlist.␈α
The␈αPDP-11
␈↓hardware␈α⊂provides␈α⊃eight␈α⊂processor␈α⊃priority␈α⊂levels.␈α⊃ These␈α⊂are␈α⊃assigned␈α⊂in␈α⊃the␈α⊂HAL␈α⊃system␈α⊂as
␈↓follows:
␈↓␈↓ αH7. AD (Analog-to-digital converter), joint servoing
␈↓␈↓ αH6. Clock, calendar
␈↓␈↓ αH5. <spare>
␈↓␈↓ αH4. ON condition checkers; Interrupt handlers for
␈↓␈↓ αHvarious condition-checking devices (eg finger pads).
␈↓␈↓ αH3. servo predictor
␈↓␈↓ αH2. <spare>
␈↓␈↓ αH1. Interpreters, scheduler for background stuff.
␈↓␈↓ αH0. Interpreters
␈↓The␈αHAL␈αsystem␈αkeeps␈αa␈αcalendar␈αof␈αthings␈αthat␈αmust␈αbe␈αdone␈αin␈αeach␈αtime␈αinterval.␈α With␈αtime
␈↓slot is associated:
␈↓␈↓ αHa. An AD command list which is to be started.
␈↓␈↓ αHb. A queue of procedure calls to make at various priority levels.
␈↓When␈αthe␈αclock␈αticks,␈α
the␈αclock␈αinterrupt␈αroutine␈α
starts␈αrunning␈αin␈αkernel␈α
mode.␈α The␈αfirst␈αthing␈α
it
␈↓does␈αis␈αto␈αstart␈αthe␈αspecified␈αAD␈αcommand␈αlist,␈αif␈αany.␈α (This␈αwill␈αcause␈αan␈αAD-done␈α
interrupt␈αin
␈↓around␈α⊃20-30␈α⊃microseconds.)␈α⊃Finally,␈α⊃it␈α⊃uses␈α⊃the␈α⊃software␈α⊃interrupts␈α⊃to␈α⊃arrange␈α⊃for␈α⊃all␈α∩of␈α⊃the
␈↓queued procedure calls to take place at the appropriate levels.
␈↓The␈αAD␈αservice␈αroutine␈αruns␈αat␈αpriority␈αlevel␈α7,␈αand␈αuses␈αregister␈αset␈αzero.␈α However,␈αit␈α
does␈αrun
␈↓in␈αuser␈αmode,␈αthus␈αsafeguarding␈αthe␈αrest␈αof␈αthe␈αsystem␈αfrom␈αbugs.␈α The␈αAD␈αcommand␈αlist␈αconsists
␈↓of a sequential table of two word entries:
␈↓␈↓ αHa. CHNCMD -- channel command
␈↓␈↓ αHb. SAMPLE -- usually, a slot for storing a sample value.
␈↓Essentially,␈α⊂the␈α⊂AD␈α⊂service␈α⊃routine␈α⊂keeps␈α⊂an␈α⊂internal␈α⊂variable␈α⊃that␈α⊂points␈α⊂to␈α⊂the␈α⊂entry␈α⊃in␈α⊂the
␈↓command␈α∞list␈α∞corresponding␈α
to␈α∞the␈α∞most␈α
recent␈α∞(current)␈α∞AD␈α
channel␈α∞command.␈α∞ When␈α∞an␈α
AD-
␈↓done␈α∞interrupt␈α∞occurs,␈α∂the␈α∞service␈α∞routine␈α∞copies␈α∂the␈α∞contents␈α∞of␈α∞the␈α∂AD␈α∞value␈α∞register␈α∂into␈α∞the
␈↓current␈α∂SAMPLE␈α∂slot.␈α∂ It␈α∂then␈α∂increments␈α∂its␈α⊂pointer␈α∂to␈α∂point␈α∂at␈α∂the␈α∂next␈α∂two␈α∂word␈α⊂entry.␈α∂ If
␈↓CHNCMD␈α∂of␈α∂the␈α∂new␈α∂entry␈α∂is␈α∂non-zero,␈α∞it␈α∂issues␈α∂the␈α∂appropriate␈α∂command␈α∂and␈α∂dismisses.␈α∞ If
␈↓II.1␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∨THE SCHEDULER␈↓
RPage 111
␈↓CHNCMD␈α∂is␈α∂zero,␈α∂then␈α∂SAMPLE␈α∂is␈α∂assumed␈α⊂to␈α∂be␈α∂the␈α∂address␈α∂of␈α∂some␈α∂code␈α∂to␈α⊂be␈α∂executed
␈↓(typically,␈α∂a␈α⊂servo).␈α∂ In␈α⊂this␈α∂case,␈α⊂the␈α∂AD␈α∂service␈α⊂routine␈α∂will␈α⊂just␈α∂clear␈α⊂its␈α∂internal␈α⊂pointer␈α∂(to
␈↓signify that it is done), and jump to the indicated address.
␈↓Typically,␈αa␈αservoing␈αoperation␈αwill␈αhave␈αtwo␈α"phases",␈αone␈αwhich␈αruns␈αat␈αlevel␈α7␈αas␈αa␈αresponse␈αto
␈↓an␈αAD-done␈αinterrupt␈α
and␈αwhich␈αis␈α
responsible␈αfor␈αemitting␈α
the␈αnew␈αdrive,␈α
and␈αa␈αsomewhat␈α
lower
␈↓priority␈α
one␈α
which␈α
requests␈α
a␈α
new␈α
time␈α
slot␈α
from␈α
the␈α
calendar␈α
management␈α
routine␈α
and␈α
sets␈αup␈α
the
␈↓correction␈α⊂phase␈α⊃for␈α⊂the␈α⊃new␈α⊂slot.␈α⊃ As␈α⊂previously␈α⊂indicated,␈α⊃this␈α⊂first␈α⊃phase␈α⊂is␈α⊃"scheduled"␈α⊂by
␈↓putting␈α
a␈α
pointer␈α
to␈α
the␈α
appropriate␈α
AD␈α
command␈α
list␈α
into␈α
the␈α
"AD␈α
request"␈α
part␈α
of␈α
a␈αcalendar
␈↓time␈αslot.␈α The␈αsecond␈αphase␈αis␈αscheduled␈αmerely␈αby␈αentering␈αit␈αonto␈αthe␈αcalendar␈αqueue␈αof␈αthings
␈↓to be requested in the same tick. Joint servos are described more fully in the next section.
␈↓If␈αa␈αnon-critical␈αprocess␈α(eg,␈αan␈αON-monitor)␈α
needs␈αa␈α"consistent"␈αset␈αof␈αAD␈αmeasurements,␈α
it␈αcan
␈↓get␈α⊂them␈α⊂by␈α⊃setting␈α⊂up␈α⊂the␈α⊃appropriate␈α⊂AD␈α⊂command␈α⊃list,␈α⊂finding␈α⊂a␈α⊃time␈α⊂slot␈α⊂for␈α⊃taking␈α⊂the
␈↓measurements,␈α∀and␈α∀then␈α∃placing␈α∀a␈α∀request␈α∀that␈α∃the␈α∀computation␈α∀that␈α∀is␈α∃to␈α∀use␈α∀the␈α∃set␈α∀of
␈↓measurements be started up at the time slot after the one in which the measurements are made.
␈↓In␈α
cases␈αwhere␈α
a␈αcommand␈α
list␈αis␈α
too␈αlong␈α
to␈αbe␈α
finished␈αin␈α
one␈αtime␈α
slot,␈αthe␈α
process␈αrequesting
␈↓the␈α⊃measurements␈α⊃must␈α⊃reserve␈α∩two␈α⊃(or␈α⊃more)␈α⊃contiguous␈α⊃slots.␈α∩ This␈α⊃is␈α⊃done␈α⊃by␈α∩placing␈α⊃the
␈↓command␈αlist␈αid␈αin␈αthe␈αfirst␈αslot␈αand␈αa␈αspecial␈αflag␈αvalue␈α(perhaps␈α-1)␈αinto␈αthe␈αremaining␈αslots,␈αso
␈↓that no other processes will try to reserve them.
␈↓␈↓∧II.2 PHILOSOPHY OF SERVOING␈↓
␈↓Control␈α∃of␈α∃the␈α∃manipulators␈α∃is␈α⊗entirely␈α∃within␈α∃the␈α∃computer.␈α∃ Position,␈α∃velocity␈α⊗and␈α∃force
␈↓information␈α⊃are␈α⊃read␈α⊃into␈α⊃the␈α⊂computer␈α⊃and␈α⊃motor␈α⊃drive␈α⊃level␈α⊂is␈α⊃output␈α⊃by␈α⊃the␈α⊃computer␈α⊂at
␈↓whatever rate the servo can accomplish.
␈↓The␈αcontrol␈αof␈αmanipulators␈αcould␈αbe␈αanalog␈α
but␈αeven␈αin␈αthe␈αsimplest␈αmode␈αof␈αoperation,␈α
position
␈↓servoing,␈αit␈αis␈αnecessary␈αto␈αconsider␈αcoordinated␈αmotion␈αof␈αall␈αsix␈αjoints␈αalong␈αa␈αtrajectory␈αdefined
␈↓by␈α∞a␈α∂sequence␈α∞of␈α∂polynomials.␈α∞ In␈α∂performing␈α∞tasks,␈α∂such␈α∞a␈α∂screwing␈α∞in␈α∂screws,␈α∞motion␈α∂is␈α∞more
␈↓complex,␈α∞involving␈α
a␈α∞combination␈α
of␈α∞position,␈α
velocity␈α∞and␈α
force␈α∞servoing;␈α
the␈α∞mode␈α∞changes␈α
in
␈↓response␈αto␈αexternal␈αand␈αinternal␈αstimuli.␈α Even␈αif␈αmany␈αmodes␈αof␈αanalog␈αservoing␈αwere␈αprovided
␈↓it␈α
would␈αstill␈α
be␈α
necessary␈αto␈α
inform␈αthe␈α
computer␈α
of␈αall␈α
the␈αservo␈α
information␈α
in␈αorder␈α
for␈α
it␈αto
␈↓interact␈αcorrectly.␈α We␈αclose␈αall␈αservo␈αloops␈αwithin␈αthe␈αcomputer␈αitself␈αand␈αuse␈αno␈αanalog␈αservos␈αat
␈↓all.␈α⊂Closing␈α⊂the␈α⊂servo␈α⊂loop␈α⊂in␈α⊃the␈α⊂computer␈α⊂requires␈α⊂very␈α⊂little␈α⊂additional␈α⊂computation␈α⊃as␈α⊂the
␈↓computer␈αmust␈αessentially␈αperform␈αa␈αservo␈αcalculation␈αin␈αorder␈αto␈αdecide␈αwhich␈αservo␈αmode␈αto␈αuse
␈↓and what set point to output.
␈↓The␈α∂limitations␈α∂imposed␈α∞by␈α∂use␈α∂of␈α∂the␈α∞computer␈α∂for␈α∂servoing␈α∂are␈α∞bandwidth␈α∂and␈α∂the␈α∂noise␈α∞of
␈↓digitizing.␈α∪The␈α∪computer␈α∪servo␈α∪is␈α∪a␈α∪sampled␈α∪data␈α∪system␈α∪of␈α∪quite␈α∪low␈α∪sample␈α∀rate.␈α∪ These
␈↓limitations␈α∂can␈α∂be␈α∂corrected,␈α⊂in␈α∂part,␈α∂by␈α∂providing␈α⊂high␈α∂frequency␈α∂velocity␈α∂feedback␈α⊂in␈α∂analog
␈↓form, without affecting the computer servo.
␈↓Page 112␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α2SERVOING␈↓ ≥II.3
␈↓␈↓∧II.3 JOINT SERVOING␈↓
␈↓Any␈αcoordinated␈αmotion␈αof␈αthe␈αarm␈αcan␈αbe␈α
expressed␈αas␈αsix␈αtime␈αdependent␈αmotions,␈αone␈αfor␈α
each
␈↓joint;␈α∂the␈α∞coordinated␈α∂motion␈α∞is␈α∂parameterized␈α∂in␈α∞terms␈α∂of␈α∞time.␈α∂ The␈α∞problem␈α∂of␈α∂servoing␈α∞the
␈↓arm, or arms, is thus reduced to a problem of servoing a number of joints with respect to time.
␈↓A␈α
joint␈α
servo␈α
has␈α
two␈α
parts:␈α
a␈α
drive␈α
part␈α
and␈α
a␈α
predictor␈α
part.␈α
As␈α
mentioned␈α
before,␈α
the␈α
drive␈α
part
␈↓is␈α
run␈α
at␈α
priority␈α
level␈α
7.␈α
When␈α
it␈αfinishes,␈α
the␈α
servo␈α
enters␈α
priority␈α
level␈α
3␈α
for␈α
the␈αpredictor.␈α
First,
␈↓the␈α⊃predictor␈α⊃reserves␈α⊃a␈α∩time␈α⊃for␈α⊃the␈α⊃next␈α∩run␈α⊃of␈α⊃this␈α⊃servo.␈α∩The␈α⊃delay␈α⊃is␈α⊃chosen␈α∩based␈α⊃on
␈↓considerations of joint response time, joint velocity, and availability of time slots.
␈↓Now␈α⊂the␈α∂predictor␈α⊂evaluates␈α∂the␈α⊂motion␈α∂polynomial␈α⊂for␈α∂the␈α⊂time␈α∂which␈α⊂it␈α∂has␈α⊂reserved.␈α∂ This
␈↓evaluation␈α∩may␈α⊃take␈α∩into␈α∩account␈α⊃an␈α∩interpolating␈α∩polynomial␈α⊃used␈α∩for␈α∩last-minute␈α⊃trajectory
␈↓modification,␈α⊃as␈α⊃well␈α⊃as␈α⊃any␈α⊃offset␈α⊃that␈α⊂might␈α⊃be␈α⊃necessary␈α⊃due␈α⊃to␈α⊃modifications␈α⊃being␈α⊂made
␈↓during␈α
the␈α
motion␈α
itself.␈α∞These␈α
calculations␈α
give␈α
the␈α∞predicted␈α
set␈α
point.␈α
The␈α∞predicted␈α
velocity
␈↓and␈α
acceleration␈α
are␈α
obtained␈α
by␈α
difference␈α
techniques␈α
based␈α
on␈α
recent␈α
set␈α
point␈α
values.␈α The␈α
joint
␈↓inertia␈αand␈α
gravity␈αforce␈α
loading␈αare␈α
interpolated.␈α The␈α
gravity␈αloading␈α
is␈αadded␈α
to␈αthe␈αproduct␈α
of
␈↓the predicted acceleration and the joint inertia to yield a predicted drive.
␈↓If␈α∀this␈α∪joint␈α∀has␈α∀multiple␈α∪wipers␈α∀then␈α∪the␈α∀appropriate␈α∀wiper␈α∪to␈α∀read␈α∪the␈α∀joint␈α∀position␈α∪is
␈↓determined.␈α∃ Then␈α∃the␈α∃joint␈α∃calibration␈α∃is␈α∃applied␈α∃to␈α∃the␈α∃set␈α∃point␈α∃to␈α∃yield␈α∃the␈α∃expected
␈↓potentiometer␈α
reading␈αfor␈α
the␈αjoint␈α
at␈αthe␈α
reserved␈αtime.␈α
The␈αservo␈α
gains,␈αwhich␈α
are␈αdependent␈α
on
␈↓joint␈α∞inertia,␈α∞are␈α∞next␈α∞calculated,␈α∂and␈α∞finally␈α∞the␈α∞servo␈α∞equation␈α∂is␈α∞set␈α∞up␈α∞in␈α∞terms␈α∂of␈α∞observed
␈↓position␈αand␈αvelocity.␈α The␈αform␈α
of␈αthe␈αservo␈αequation␈αis␈α
dependent␈αon␈αwhether␈αthe␈αjoint␈αis␈α
being
␈↓run␈α∂with␈α∂position,␈α⊂velocity,␈α∂or␈α∂force␈α⊂servoing.␈α∂ Having␈α∂done␈α∂all␈α⊂this␈α∂predictive␈α∂work,␈α⊂the␈α∂joint
␈↓servo dismisses control.
␈↓When␈α
the␈α
reserved␈α
time␈α
occurs,␈αthe␈α
drive␈α
part␈α
of␈α
the␈α
servo␈αruns␈α
in␈α
priority␈α
level␈α
7.␈α
The␈αdrive␈α
part
␈↓measures␈α
the␈α
position␈α
and␈αvelocity,␈α
evaluates␈α
the␈α
servo␈αequation␈α
prepared␈α
by␈α
the␈αpredictor,␈α
applies
␈↓friction␈α
compensation␈α
and␈α∞drives␈α
the␈α
joint.␈α∞ This␈α
is␈α
a␈α
very␈α∞fast␈α
computation␈α
and␈α∞minimizes␈α
any
␈↓delay␈α∩between␈α∩observation␈α∩and␈α∩action.␈α∩ The␈α∩predictor␈α∩is␈α∩then␈α∩run␈α∩again␈α∩for␈α∩the␈α∩next␈α∩servo
␈↓scheduling, as described above.
␈↓Upon␈α
completion␈αof␈α
the␈α
motion,␈αor␈α
if␈α
some␈αerror␈α
should␈αoccur,␈α
or␈α
if␈αsome␈α
other␈α
process␈αrequests
␈↓that the joint stop, completion codes are set for the joint, and then the servo terminates.
␈↓The␈αadvantage␈αof␈αthis␈αservo␈αscheme␈αis␈αthat␈αit␈αallows␈αflexible␈αscheduling:␈αeach␈αjoint␈αcan␈αrun␈αat␈αits
␈↓own␈α
required␈α
repetition␈α
rate.␈α
As␈α
the␈α
joint␈α
knows␈α∞when␈α
it␈α
will␈α
be␈α
run␈α
next␈α
it␈α
is␈α
possible␈α∞to␈α
pre-
␈↓compute most of the drive and thus reduce the servo delay.
␈↓Each␈α
servo␈α
routine␈α
has␈α
a␈α
control␈α
block␈α
which␈αincludes␈α
a␈α
status␈α
register.␈α
In␈α
the␈α
case␈α
of␈α
a␈αjoint␈α
servo
␈↓the status register contains the following bits:
␈↓II.3␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∪SERVOING␈↓
RPage 113
␈↓ RUN joint is running or about to be run
␈↓ FIRST first time through loop for this motion.
␈↓ FINAL in final state, nulling errors
␈↓ STOP stop this joint, or joint is stopped
␈↓ EXFORCE joint stopped due to excessive force.
␈↓ ADERR a/d error
␈↓ NONEX joint is down or does not exist
␈↓ STERR servo was not run on schedule
␈↓ SERVO position servo
␈↓ VELS velocity servo
␈↓ FORCE exert force
␈↓ WOB perturb this joint while running
␈↓ NUL null errors at end and stop
␈↓When␈α
the␈α
servo␈α
is␈α
started␈α
up␈α
for␈α
the␈α
first␈α
time,␈α
it␈α
is␈α
given␈α
certain␈α
information,␈α
including␈α
which
␈↓joint␈α∩it␈α∩should␈α∩servo,␈α∪what␈α∩the␈α∩properties␈α∩of␈α∩that␈α∪joint␈α∩are,␈α∩what␈α∩polynomial␈α∩to␈α∪follow,␈α∩the
␈↓predicted gravity torque and inertia loadings.
␈↓␈↓∧II.4 TRAJECTORIES␈↓
␈↓A␈α∞trajectory␈α
for␈α∞the␈α
hand␈α∞is␈α
generated␈α∞at␈α
compile␈α∞time␈α
under␈α∞the␈α
assumption␈α∞that␈α∞the␈α
planning
␈↓values␈α⊃for␈α∩the␈α⊃initial␈α⊃point,␈α∩departure␈α⊃point,␈α⊃via␈α∩points,␈α⊃arrival␈α⊃point␈α∩and␈α⊃final␈α∩position␈α⊃are
␈↓accurate.
␈↓If␈α⊂at␈α∂run␈α⊂time␈α∂it␈α⊂is␈α∂found␈α⊂that␈α⊂some␈α∂or␈α⊂all␈α∂of␈α⊂these␈α∂planned␈α⊂positions␈α∂have␈α⊂moved␈α⊂slightly␈α∂it
␈↓becomes␈α
necessary␈α∞to␈α
modify␈α∞the␈α
planned␈α∞trajectory␈α
to␈α
pass␈α∞through␈α
the␈α∞actual␈α
positions.␈α∞ If␈α
the
␈↓actual␈α∞positions␈α
are␈α∞only␈α
slightly␈α∞different␈α∞from␈α
the␈α∞planned␈α
positions␈α∞then␈α
the␈α∞trajectory␈α∞is␈α
still
␈↓almost␈α⊂optimal,␈α⊂that␈α⊂is,␈α∂it␈α⊂still␈α⊂has␈α⊂most␈α∂of␈α⊂the␈α⊂properties␈α⊂with␈α∂which␈α⊂it␈α⊂was␈α⊂designed.␈α⊂ If␈α∂the
␈↓deviation␈αfrom␈αthe␈αplanned␈αvalues␈αto␈αthe␈αactual␈α
are␈αgreat␈αthen␈αthe␈αtrajectory␈αis␈αno␈αlonger␈α
optimal.
␈↓To␈αplan␈αa␈αnew␈αtrajectory␈αwould␈αagain␈αoptimize␈α
the␈αmove,␈αbut␈αonly␈αif␈αthe␈αtime␈αto␈αcompute␈α
is␈αless
␈↓than␈αthe␈α
time␈αsaved␈α
is␈αit␈α
worth␈αrecomputing.␈α At␈α
present␈αthis␈α
is␈αnot␈α
the␈αcase,␈α
so␈αno␈αrecalculation␈α
of
␈↓trajectories is done. Instead, the following trajectory modification step is performed:
␈↓Before␈α∪the␈α∩move␈α∪is␈α∩executed,␈α∪it␈α∩is␈α∪prepared␈α∩by␈α∪computing␈α∩the␈α∪discrepancies␈α∪between␈α∩actual
␈↓locations␈α⊂and␈α⊂planned␈α⊃locations.␈α⊂ Fifth␈α⊂degree␈α⊂interpolating␈α⊃polynomials␈α⊂(with␈α⊂zero␈α⊃initial␈α⊂and
␈↓final␈α
velocity␈αand␈α
acceleration)␈α
are␈αcomputed␈α
to␈α
be␈αadded␈α
into␈α
the␈αplanned␈α
polynomials␈α
to␈αbring
␈↓the␈αplanned␈αtrajectory␈αinto␈αline␈αwith␈αreality.␈α The␈αjoint␈αangles␈αassociated␈αwith␈αa␈αframe␈αare␈αstored
␈↓along␈αwith␈αits␈αmatrix,␈αso␈αthis␈αoften␈αdoes␈αnot␈αinvolve␈αmuch␈αcalculation,␈αunless␈αthe␈αframe␈αhas␈αbeen
␈↓changed␈α∞since␈α∞these␈α∞calculations␈α∞were␈α∞done␈α∞last.␈α∞Also␈α∞at␈α∞this␈α∞time␈α∞the␈α∞joint␈α∞inertias␈α∂and␈α∞gravity
␈↓loadings are calculated and stored in the value cell of relevant frames.
␈↓Page 114␈α?␈α?␈α?␈α?␈α?␈α?␈α
INTERPRETABLE CODE␈↓ ≥II.5
␈↓␈↓∧II.5 INTERPRETABLE CODE␈↓
␈↓The␈αbasic␈αinstruction␈αemitted␈αby␈αthe␈αcompiler␈αis␈αone␈α16-bit␈αword.␈α The␈αfirst␈α8␈αbits␈αare␈αthe␈αopcode,
␈↓and␈αthe␈αlast␈α8␈αare␈αused␈αto␈αform␈αthe␈αoperand␈αaddress,␈αif␈αthe␈αopcode␈αneeds␈αone.␈α Addressing␈αmodes
␈↓are␈α∞either␈α∞immediate,␈α
in␈α∞which␈α∞case␈α
the␈α∞next␈α∞word␈α
has␈α∞the␈α∞address,␈α
or␈α∞relative␈α∞(to␈α∞the␈α
program
␈↓counter).␈α Immediate␈αaddressing␈αis␈αindicated␈αby␈αthe␈αsecond␈αbyte␈αbeing␈α0.␈α Anything␈αelse␈αis␈αrelative
␈↓addressing;␈α∂bit␈α∂8␈α∂(the␈α∞lefthand␈α∂bit␈α∂of␈α∂the␈α∂righthand␈α∞byte)␈α∂is␈α∂a␈α∂sign␈α∞bit;␈α∂thus␈α∂one␈α∂can␈α∂look␈α∞127
␈↓locations␈α⊃forward␈α⊂or␈α⊃backward;␈α⊃the␈α⊂full␈α⊃word␈α⊃address␈α⊂will␈α⊃be␈α⊃found␈α⊂at␈α⊃this␈α⊃place.␈α⊂ Full-word
␈↓addresses␈αcan␈αbe␈αindirect;␈αthis␈αis␈αindicated␈αby␈αa␈αhigh-order␈αbit␈α(ie,␈αbit␈α0)␈αbeing␈α1.␈α Indirection␈αcan
␈↓proceed to any level.
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α(STACK OPERATORS
␈↓pushadr <arg> ␈↓ βHputs␈α
<arg>␈α
on␈α
top␈α
of␈α
the␈α
stack.␈α
It␈α
is␈α
assumed␈α
that␈α
<arg>␈α
is␈α
the␈α
address␈α
of␈α
a
␈↓␈↓ βHvariable.
␈↓pushval <arg> ␈↓ βHputs␈α⊃value␈α⊃of␈α∩variable␈α⊃pointed␈α⊃to␈α∩by␈α⊃<arg>␈α⊃on␈α∩stack.␈α⊃ gets␈α⊃good␈α∩value,␈α⊃if
␈↓␈↓ βHnecessary.
␈↓pop ␈↓ βHpops the stack.
␈↓copy <num> ␈↓ βHfinds the <num>'th element down in the stack, and copies it to the top.
␈↓flush ␈↓ βHclears the stack.
␈↓store <arg> ␈↓ βHpointer at top of stack copied into value pointer at <arg>; stack is popped.
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α!SINGLE FRAME OPERATIONS
␈↓solve ␈↓ βHtakes␈α
a␈α
pointer␈α
to␈α
a␈α
frame␈α
value␈α
cell␈α
from␈α
top␈α
of␈α
stack.␈α
Generates␈αarm␈α
solution
␈↓␈↓ βH(if necessary) and stores in the value cell. The stack is popped.
␈↓invert ␈↓ βHthe␈α⊃inverse␈α⊂of␈α⊃the␈α⊃value␈α⊂cell␈α⊃at␈α⊃top␈α⊂of␈α⊃stack␈α⊂goes␈α⊃to␈α⊃top␈α⊂of␈α⊃stack;␈α⊃old␈α⊂top
␈↓␈↓ βHpopped.
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α ARITHMETIC
␈↓For␈αthe␈αfollowing,␈α
the␈αargs␈αare␈α
on␈αthe␈αstack,␈αare␈α
popped␈αafter␈αthe␈α
operation,␈αthe␈αanswer␈αpointed␈α
to
␈↓on top of stack. Earlier arguments deeper on the stack.
␈↓s+s ␈↓ βHscalar addition. 2 args.
␈↓s-s ␈↓ βHscalar subtraction. 2 args.
␈↓s*s ␈↓ βHscalar multiplication. 2. args.
␈↓s/s ␈↓ βHscalar division. error if second arg is 0. 2 args.
␈↓|v| ␈↓ βHmagnitude of vector. 1 arg.
␈↓v.v ␈↓ βHdot product. returns scalar.
␈↓(sss) ␈↓ βHforms vector from 3 scalars. 3 args.
␈↓s*v ␈↓ βHdilation of vector. 2 args. scalar first.
␈↓v+v ␈↓ βHvector addition. 2 args.
␈↓v∂v ␈↓ βHvector rotated by vector. second arg is rotation. 2 args.
␈↓t*v ␈↓ βHtransformation of vector. trans first. 2 args.
␈↓[v:v] ␈↓ βHforms frame from 2 vectors. first is loc, second orient.
␈↓f+v ␈↓ βHtranslation of frame. 2 args. frame first.
␈↓f∂v ␈↓ βHrotation of frame. 2 args. frame first.
␈↓t*f ␈↓ βHtransformation of frame. 2 args. frame first.
␈↓II.5␈α?␈α?␈α?␈α?␈α?␈α?␈α-INTERPRETABLE CODE␈↓
RPage 115
␈↓f→f ␈↓ βHforms trans from two frames. 2 args. f1'f2.
␈↓[v|v] ␈↓ βHforms trans from two vectors. 1: trans; 2: rot.
␈↓t+v ␈↓ βHtranslates trans. 2 args. trans first.
␈↓t∂v ␈↓ βHrotates trans. 2 args. trans first.
␈↓t*t ␈↓ βHcomposition (to the left) of two transes.
␈↓tinv ␈↓ βHinverse of trans
␈↓␈α?␈α?␈α?␈α?␈α?␈α6EXTRACTION AND COMPOSITION
␈↓loc ␈↓ βHlocation of frame replaces it at top of stack.
␈↓orient ␈↓ βHorientation of frame replaces it at top of stack.
␈↓xscal ␈↓ βHx coordinate of vector replaces it at top of stack.
␈↓yscal ␈↓ βHy coordinate of vector replaces it at top of stack.
␈↓zscal ␈↓ βHz coordinate of vector replaces it at top of stack.
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α(PROCESS CONTROL
␈↓sprout <arg> ␈↓ βHstart up an interpreter with program counter <arg>.
␈↓enable <arg> ␈↓ βHstart up an on-monitor with location of status word <arg>.
␈↓disable <arg> ␈↓ βHthe on-monitor with location of status word <arg> is disabled.
␈↓wait ␈↓ βHwait␈α∩until␈α∪all␈α∩descendant␈α∪(non␈α∩on-monitor)␈α∩processes␈α∪are␈α∩dead.␈α∪ Then␈α∩kill
␈↓␈↓ βHdescendant move on-monitors and continue.
␈↓terminate ␈↓ βHterminate this process. Should first call "wait".
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α∀JUMPS
␈↓This list is not complete.
␈↓jump <arg>
␈↓nop ␈↓ βHno-op.
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α"ARM AND DEVICE CONTROL
␈↓prepmove <arg> ␈↓ βH<arg> points to the move vector. Trajectory modification happens now.
␈↓startmove ␈↓ βHsprouts joint servos and move-monitors
␈↓search <arg> ␈↓ βH<arg> points to the search vector.
␈↓stop <arg> ␈↓ βH<arg> encoding of what devices must be stopped.
␈↓␈α)INPUT AND OUTPUT Some sort of I/O will be implemented, most likely including string
␈α!␈↓output to the supervisor, error message output, and input (from supervisor or from coresident
␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α3␈↓routines) of value cells.
␈↓␈α?␈α?␈α?␈α?␈α?␈α?␈α?␈α;DEBUGGING AIDS
␈↓source <arg> ␈↓ βHnotes that <arg> is where the interpreter is now in source code.
␈↓tellsource ␈↓ βHoutput current source location to the 10.
␈↓step ␈↓ βHbegins␈αstep␈αmode,␈αwhich␈αdoes␈αone␈αinterpretation␈αat␈αa␈αtime,␈αrequires␈αmessage␈αto
␈↓␈↓ βHcontinue.
␈↓offstep ␈↓ βHturns off step mode; normal speed is resumed.
␈↓Page 116␈α?␈α?␈α?␈α?␈α?␈α?␈α≠GRAPH ALGORITHMS␈↓ ≥II.6
␈↓␈↓∧II.6 ALGORITHMS FOR USE OF GRAPH STRUCTURE␈↓
␈↓These␈αare␈αthe␈α
algorithms␈αused␈αto␈αfind␈α
values␈αfor␈αvariables␈αin␈α
the␈αgraph␈αstructure␈αand␈α
to␈αchange
␈↓those values.
␈↓PROCEDURE invalidate (POINTER(NODE) n);
␈↓ IF invmark(n)=0 THEN
␈↓ BEGIN COMMENT: This cell currently marked valid;
␈↓ POINTER p;
␈↓ invmark(n)← -1;
␈↓ p ← dependents(n);
␈↓ WHILE p␈↓ε≠␈↓NULL DO
␈↓ BEGIN COMMENT: Mark all dependents as invalid;
␈↓ invalidate(p);
␈↓ p ← link(p)
␈↓ END
␈↓ END;
␈↓PROCEDURE change (POINTER(NODE) n; POINTER(VALUE) vnew);
␈↓ BEGIN
␈↓ COMMENT: This procedure is called in order to explicitly assign
␈↓ a new value, vnew, to node n;
␈↓ POINTER(VALUE) vold;
␈↓ invalidate(n);
␈↓ vold ← value(n);
␈↓ value(n)←vnew;
␈↓ p ← changer(n);
␈↓ WHILE p␈↓ε≠␈↓NULL DO
␈↓ BEGIN COMMENT: Handle all changers;
␈↓ APPLY(code(p),vold,vnew);
␈↓ p ← link(p);
␈↓ END;
␈↓ invmark(n) ← 0;
␈↓ END;
␈↓POINTER(VALUE) PROCEDURE getvalue (POINTER(NODE) n);
␈↓ BEGIN
␈↓ IF invmark(n)␈↓ε≠␈↓0 THEN evalnode(n, time ← time+1);
␈↓ RETURN(value(n));
␈↓ END;
␈↓II.6␈α?␈α?␈α?␈α?␈α?␈α?␈α;GRAPH ALGORITHMS␈↓
RPage 117
␈↓PROCEDURE evalnode (POINTER(NODE) n, INTEGER t);
␈↓ BEGIN COMMENT: Put a good value in the value cell of n.
␈↓ t is used to break cycles;
␈↓ IF invmark(n)=0 ∨ invmark(n)=t THEN RETURN;
␈↓ invmark(n) ← t;
␈↓ p ← calculator(n);
␈↓ WHILE p ␈↓ε≠␈↓ NULL DO
␈↓ BEGIN "cloop"
␈↓ POINTER(dependent) d;
␈↓ d ← needed(p);
␈↓ WHILE d ␈↓ε≠␈↓ NULL DO
␈↓ BEGIN
␈↓ evalnode(dep(d),t);
␈↓ IF invmark(dep(d))␈↓ε≠␈↓0 THEN
␈↓ BEGIN
␈↓ p ← next(p);
␈↓ CONTINUE "cloop";
␈↓ END;
␈↓ d ← next(d);
␈↓ END;
␈↓ value(n)←APPLY(code(p), args(p));
␈↓ invmark(n)←0;
␈↓ RETURN;
␈↓ END;
␈↓ END;